Esempio n. 1
0
 function it_does_not_clean_up_workers_on_another_host(SystemInterface $system, $workerRegistry, WorkerInterface $localWorker, WorkerInterface $remoteWorker, Process $localProcess, Process $remoteProcess)
 {
     $system->getCurrentPid()->willReturn(6545);
     $system->getHostname()->shouldBeCalled()->willReturn('bar.resque.com');
     $workerRegistry->all()->shouldBeCalled()->willReturn([$localWorker, $remoteWorker]);
     $localWorker->getProcess()->shouldBeCalled()->willReturn($localProcess);
     $remoteWorker->getProcess()->shouldBeCalled()->willReturn($remoteProcess);
     $localWorker->getHostname()->shouldBeCalled()->willReturn('bar.resque.com');
     $remoteWorker->getHostname()->shouldBeCalled()->willReturn('my.other.host');
     $localProcess->getPid()->willReturn(1);
     $remoteProcess->getPid()->willReturn(1);
     $workerRegistry->deregister($localWorker)->shouldBeCalled();
     $workerRegistry->deregister($remoteWorker)->shouldNotBeCalled();
     $this->pruneDeadWorkers();
 }