mirror of
https://github.com/predis/predis.git
synced 2026-10-08 04:46:38 +00:00
Fixed SENTINEL SLAVES RESP3 incompatible response (#1676)
* Fixed SENTINEL SLAVES RESP3 incompatible response * Updated CHANGELOG.md * Revert relay-incompatible annotations
This commit is contained in:
committed by
GitHub
parent
f12e6694b5
commit
b2d1397fc6
@@ -1718,6 +1718,35 @@ class ClientTest extends PredisTestCase
|
||||
$this->assertTrue($master->isConnected());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group connected
|
||||
* @group sentinel
|
||||
* @group relay-incompatible
|
||||
* @requiresRedisVersion >= 7.0.0
|
||||
*/
|
||||
public function testSentinelReplicationConnectionWithResp3(): void
|
||||
{
|
||||
$client = $this->createClient(['protocol' => 3]);
|
||||
$connection = $client->getConnection();
|
||||
|
||||
$this->assertInstanceOf(SentinelReplication::class, $connection);
|
||||
|
||||
// SENTINEL slaves returns a map under RESP3 - calling getSlaves()
|
||||
// exercises the parsing path that previously read fields by
|
||||
// positional index. We do not assert on cardinality because the
|
||||
// CI topology may not include replicas; we only require that the
|
||||
// call completes without protocol-incompatibility errors.
|
||||
$slaves = $connection->getSlaves();
|
||||
$this->assertIsArray($slaves);
|
||||
|
||||
foreach ($slaves as $slave) {
|
||||
$this->assertInstanceOf('Predis\Connection\NodeConnectionInterface', $slave);
|
||||
}
|
||||
|
||||
$client->set('sentinel_resp3_test_key', 'sentinel_resp3_test_value');
|
||||
$this->assertEquals('sentinel_resp3_test_value', $client->get('sentinel_resp3_test_key'));
|
||||
}
|
||||
|
||||
// ******************************************************************** //
|
||||
// ---- HELPER METHODS ------------------------------------------------ //
|
||||
// ******************************************************************** //
|
||||
|
||||
Reference in New Issue
Block a user