Exemplo n.º 1
0
 function it_tails_logs(MonitoredQueue $metro)
 {
     $metro->getHistory('123')->willReturn([['some date', 'processing']], [['some date', 'not processing anymore']]);
     $metro->getLog('123', 0)->willReturn(["first chunk\n", "second chunk\n"]);
     $metro->getLog('123', 2)->willReturn(["third chunk\n"]);
     $output = $this->execute(['--tail' => true, 'job-id' => '123']);
     expect($output->fetch())->toReturn("first chunk\nsecond chunk\nthird chunk\n");
 }
Exemplo n.º 2
0
 function it_can_filter_output(MonitoredQueue $metro)
 {
     $job = new CommittedJob('123', 'default', 'StdClass', 'arg1');
     $metro->getJob('123')->willReturn($job);
     $metro->getHistory('123')->willReturn([['some date', 'queued'], ['some later date', 'finished']]);
     $output = $this->execute(['id' => '123', '--filter' => '.history[0]']);
     $json = $output->fetch();
     expect(json_decode($json, true))->toEqual(['some date', 'queued']);
 }