Skip to content

Commit eb1cfb2

Browse files
tests/integration/standard: don't compare Host instances
Only compare hosts endpoints not whole Host instances as we don't know hosts ids.
1 parent a92be80 commit eb1cfb2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/integration/standard/test_policies.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ def test_predicate_changes(self):
4545
external_event = True
4646
contact_point = DefaultEndPoint("127.0.0.1")
4747

48-
single_host = {Host(contact_point, SimpleConvictionPolicy)}
49-
all_hosts = {Host(DefaultEndPoint("127.0.0.{}".format(i)), SimpleConvictionPolicy) for i in (1, 2, 3)}
50-
5148
predicate = lambda host: host.endpoint == contact_point if external_event else True
5249
hfp = ExecutionProfile(
5350
load_balancing_policy=HostFilterPolicy(RoundRobinPolicy(), predicate=predicate)
@@ -62,7 +59,8 @@ def test_predicate_changes(self):
6259
response = session.execute("SELECT * from system.local WHERE key='local'")
6360
queried_hosts.update(response.response_future.attempted_hosts)
6461

65-
assert queried_hosts == single_host
62+
assert len(queried_hosts) == 1
63+
assert queried_hosts.pop().endpoint == contact_point
6664

6765
external_event = False
6866
futures = session.update_created_pools()
@@ -72,7 +70,8 @@ def test_predicate_changes(self):
7270
for _ in range(10):
7371
response = session.execute("SELECT * from system.local WHERE key='local'")
7472
queried_hosts.update(response.response_future.attempted_hosts)
75-
assert queried_hosts == all_hosts
73+
assert len(queried_hosts) == 3
74+
assert {host.endpoint for host in queried_hosts} == {DefaultEndPoint(f"127.0.0.{i}") for i in range(1, 4)}
7675

7776

7877
class WhiteListRoundRobinPolicyTests(unittest.TestCase):

0 commit comments

Comments
 (0)