Skip to content

Commit 4a81d2c

Browse files
committed
Fix cluster reconnect test to match server by port only
1 parent 46377ec commit 4a81d2c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

nats-client/tests/test_client.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -525,17 +525,16 @@ def on_reconnect():
525525
# Shut down servers one by one (shut down the server we're connected to)
526526
for i in range(len(cluster.servers) - 1): # Keep last server running
527527
# Find which server the client is currently connected to using server_info
528-
connected_host = client.server_info.host
529528
connected_port = client.server_info.port
530529

531-
# Find the matching server in the cluster
530+
# Find the matching server in the cluster by port
532531
server_to_shutdown = None
533532
for server in cluster.servers:
534-
if server.host == connected_host and server.port == connected_port:
533+
if server.port == connected_port:
535534
server_to_shutdown = server
536535
break
537536

538-
assert server_to_shutdown is not None, f"Could not find server for {connected_host}:{connected_port}"
537+
assert server_to_shutdown is not None, f"Could not find server for port {connected_port}"
539538

540539
# Shutdown the connected server
541540
await server_to_shutdown.shutdown()

0 commit comments

Comments
 (0)