Skip to content

Commit a92be80

Browse files
tests/integration/standard: update test to reflect new behavior
Previously, the driver relied on the load-balancing policy (LBP) to determine the order of hosts to connect to. Since the default LBP is Round Robin, each reconnection would start from a different host. After removing fake hosts with random IDs at startup, this behavior changed. When the LBP is not yet initialized, the driver now uses the endpoints provided by the control connection (CC), so there is no guarantee that different hosts will be selected on reconnection. This change updates the test logic to first establish a connection and initialize the LBP, and only then verify that two subsequent reconnections land on different hosts in a healthy cluster.
1 parent 2784e3f commit a92be80

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/integration/standard/test_control_connection.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,12 @@ def test_get_control_connection_host(self):
101101

102102
# reconnect and make sure that the new host is reflected correctly
103103
self.cluster.control_connection._reconnect()
104-
new_host = self.cluster.get_control_connection_host()
105-
assert host != new_host
104+
new_host1 = self.cluster.get_control_connection_host()
105+
106+
self.cluster.control_connection._reconnect()
107+
new_host2 = self.cluster.get_control_connection_host()
108+
109+
assert new_host1 != new_host2
106110

107111
# TODO: enable after https://github.com/scylladb/python-driver/issues/121 is fixed
108112
@unittest.skip('Fails on scylla due to the broadcast_rpc_port is None')

0 commit comments

Comments
 (0)