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:
Vladyslav Vildanov
2026-05-14 09:56:32 +03:00
committed by GitHub
parent f12e6694b5
commit b2d1397fc6
4 changed files with 94 additions and 4 deletions
+29
View File
@@ -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 ------------------------------------------------ //
// ******************************************************************** //