@@ -39,7 +39,7 @@ protected function setUp(): void
3939
4040 try {
4141 $ this ->redis = $ this ->createRedisClient ();
42- $ this ->connection = Connection::fromDsn (getenv ('MESSENGER_REDIS_DSN ' ), [' sentinel_master ' => getenv ( ' MESSENGER_REDIS_SENTINEL_MASTER ' ) ?: null ], $ this ->redis );
42+ $ this ->connection = Connection::fromDsn (getenv ('MESSENGER_REDIS_DSN ' ), [], $ this ->redis );
4343 $ this ->connection ->cleanup ();
4444 $ this ->connection ->setup ();
4545 } catch (\Exception $ e ) {
@@ -147,7 +147,7 @@ public function testConnectionSendDelayedMessagesWithSameContent()
147147 public function testConnectionBelowRedeliverTimeout ()
148148 {
149149 // lower redeliver timeout and claim interval
150- $ connection = Connection::fromDsn (getenv ('MESSENGER_REDIS_DSN ' ), [' sentinel_master ' => getenv ( ' MESSENGER_REDIS_SENTINEL_MASTER ' ) ?: null ], $ this ->redis );
150+ $ connection = Connection::fromDsn (getenv ('MESSENGER_REDIS_DSN ' ), [], $ this ->redis );
151151
152152 $ connection ->cleanup ();
153153 $ connection ->setup ();
@@ -175,7 +175,7 @@ public function testConnectionClaimAndRedeliver()
175175 // lower redeliver timeout and claim interval
176176 $ connection = Connection::fromDsn (
177177 getenv ('MESSENGER_REDIS_DSN ' ),
178- ['redeliver_timeout ' => 0 , 'claim_interval ' => 500 , ' sentinel_master ' => getenv ( ' MESSENGER_REDIS_SENTINEL_MASTER ' ) ?: null ],
178+ ['redeliver_timeout ' => 0 , 'claim_interval ' => 500 ],
179179
180180 $ this ->redis
181181 );
@@ -251,7 +251,17 @@ public function testSentinel()
251251
252252 public function testLazySentinel ()
253253 {
254- $ connection = Connection::fromDsn (getenv ('MESSENGER_REDIS_DSN ' ),
254+ if (!$ hosts = getenv ('REDIS_SENTINEL_HOSTS ' )) {
255+ $ this ->markTestSkipped ('REDIS_SENTINEL_HOSTS env var is not defined. ' );
256+ }
257+
258+ if (!getenv ('MESSENGER_REDIS_SENTINEL_MASTER ' )) {
259+ $ this ->markTestSkipped ('MESSENGER_REDIS_SENTINEL_MASTER env var is not defined. ' );
260+ }
261+
262+ $ dsn = 'redis:?host[ ' .str_replace (' ' , ']&host[ ' , $ hosts ).'] ' ;
263+
264+ $ connection = Connection::fromDsn ($ dsn ,
255265 ['lazy ' => true ,
256266 'delete_after_ack ' => true ,
257267 'sentinel_master ' => getenv ('MESSENGER_REDIS_SENTINEL_MASTER ' ) ?: null ,
@@ -326,7 +336,7 @@ public function testFromDsnWithMultipleHosts()
326336 $ dsn = array_map (fn ($ host ) => 'redis:// ' .$ host , $ hosts );
327337 $ dsn = implode (', ' , $ dsn );
328338
329- $ this ->assertInstanceOf (Connection::class, Connection::fromDsn ($ dsn , [' sentinel_master ' => getenv ( ' MESSENGER_REDIS_SENTINEL_MASTER ' ) ?: null ]));
339+ $ this ->assertInstanceOf (Connection::class, Connection::fromDsn ($ dsn , []));
330340 }
331341
332342 public function testJsonError ()
@@ -450,7 +460,7 @@ private function getConnectionStream(Connection $connection): string
450460 private function skipIfRedisClusterUnavailable ()
451461 {
452462 try {
453- new \RedisCluster (null , getenv ('REDIS_CLUSTER_HOST ' ) ? explode (' ' , getenv ('REDIS_CLUSTER_HOST ' )) : []);
463+ new \RedisCluster (null , getenv ('REDIS_CLUSTER_HOSTS ' ) ? explode (' ' , getenv ('REDIS_CLUSTER_HOSTS ' )) : []);
454464 } catch (\Exception $ e ) {
455465 self ::markTestSkipped ($ e ->getMessage ());
456466 }
0 commit comments