public function testRemoteDispatchReplyTimeout() { $this->localSegment->subscribe(TestCommand::class, new TestCommandHandler()); $remoteTemplate = new RedisTemplate('tcp://127.0.0.1:6379?read_write_timeout=-1', 'test-node2', []); $remoteTemplate->subscribe(TestCommand::class); $this->template->setTimeout(1); $interceptor = new DispatchInterceptor(); $this->localSegment->setDispatchInterceptors([$interceptor]); $callback = new ClosureCommandCallback(function ($result) { $this->fail('Exception expected'); }, function ($error) { $this->assertInstanceOf(CommandTimeoutException::class, $error); }); $this->testSubject->send('key', GenericCommandMessage::asCommandMessage(new TestCommand('key')), $callback); $this->assertEmpty($interceptor->commands); $this->assertEmpty($this->template->getClient()->keys('governor:response:*')); $this->assertCount(1, $this->template->getPendingCommands($remoteTemplate->getNodeName())); }
public function tearDown() { $this->testSubject->getClient()->flushall(); }