@@ -380,20 +380,22 @@ async def test_cluster_retry_object(self, request: FixtureRequest) -> None:
380
380
async with RedisCluster .from_url (url ) as rc_default :
381
381
# Test default retry
382
382
retry = rc_default .connection_kwargs .get ("retry" )
383
+
384
+ # FIXME: Workaround for https://github.com/redis/redis-py/issues/3030
385
+ host = rc_default .get_default_node ().host
386
+
383
387
assert isinstance (retry , Retry )
384
388
assert retry ._retries == 3
385
389
assert isinstance (retry ._backoff , type (default_backoff ()))
386
- assert rc_default .get_node ("127.0.0.1" , 16379 ).connection_kwargs .get (
390
+ assert rc_default .get_node (host , 16379 ).connection_kwargs .get (
387
391
"retry"
388
- ) == rc_default .get_node ("127.0.0.1" , 16380 ).connection_kwargs .get ("retry" )
392
+ ) == rc_default .get_node (host , 16380 ).connection_kwargs .get ("retry" )
389
393
390
394
retry = Retry (ExponentialBackoff (10 , 5 ), 5 )
391
395
async with RedisCluster .from_url (url , retry = retry ) as rc_custom_retry :
392
396
# Test custom retry
393
397
assert (
394
- rc_custom_retry .get_node ("127.0.0.1" , 16379 ).connection_kwargs .get (
395
- "retry"
396
- )
398
+ rc_custom_retry .get_node (host , 16379 ).connection_kwargs .get ("retry" )
397
399
== retry
398
400
)
399
401
@@ -402,17 +404,15 @@ async def test_cluster_retry_object(self, request: FixtureRequest) -> None:
402
404
) as rc_no_retries :
403
405
# Test no connection retries
404
406
assert (
405
- rc_no_retries .get_node ("127.0.0.1" , 16379 ).connection_kwargs .get (
406
- "retry"
407
- )
407
+ rc_no_retries .get_node (host , 16379 ).connection_kwargs .get ("retry" )
408
408
is None
409
409
)
410
410
411
411
async with RedisCluster .from_url (
412
412
url , retry = Retry (NoBackoff (), 0 )
413
413
) as rc_no_retries :
414
414
assert (
415
- rc_no_retries .get_node ("127.0.0.1" , 16379 )
415
+ rc_no_retries .get_node (host , 16379 )
416
416
.connection_kwargs .get ("retry" )
417
417
._retries
418
418
== 0
0 commit comments