From a47a06895dea0d5b18796bed0a1aafec00ba5d84 Mon Sep 17 00:00:00 2001 From: GregBestland Date: Thu, 22 Sep 2016 15:18:04 -0500 Subject: [PATCH] Various test fixes --- tests/integration/long/test_consistency.py | 3 +++ tests/integration/standard/test_cluster.py | 4 ++-- tests/integration/standard/test_metrics.py | 4 ++++ tests/integration/standard/test_query.py | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/integration/long/test_consistency.py b/tests/integration/long/test_consistency.py index 018cc455..f983a43d 100644 --- a/tests/integration/long/test_consistency.py +++ b/tests/integration/long/test_consistency.py @@ -334,6 +334,9 @@ class ConnectivityTest(unittest.TestCase): hosts = cluster.metadata.all_hosts() address = hosts[0].address node_to_stop = int(address.split('.')[-1:][0]) + cluster.shutdown() + cluster = Cluster(protocol_version=PROTOCOL_VERSION) + cluster.connect(contact_points=["127.0.0.2"], wait_for_all_pools=True) try: force_stop(node_to_stop) wait_for_down(cluster, node_to_stop) diff --git a/tests/integration/standard/test_cluster.py b/tests/integration/standard/test_cluster.py index 39ecf1e5..e41eec7e 100644 --- a/tests/integration/standard/test_cluster.py +++ b/tests/integration/standard/test_cluster.py @@ -1035,12 +1035,12 @@ class HostStateTest(unittest.TestCase): @test_category connection """ with Cluster(protocol_version=PROTOCOL_VERSION) as cluster: - session = cluster.connect() + session = cluster.connect(wait_for_all_pools=True) random_host = cluster.metadata.all_hosts()[0] cluster.on_down(random_host, False) for _ in range(10): new_host = cluster.metadata.all_hosts()[0] - self.assertTrue(new_host.is_up) + self.assertTrue(new_host.is_up, "Host was not up on iteration {0}".format(_)) time.sleep(.01) pool = session._pools.get(random_host) diff --git a/tests/integration/standard/test_metrics.py b/tests/integration/standard/test_metrics.py index efacc4c0..c59b58f9 100644 --- a/tests/integration/standard/test_metrics.py +++ b/tests/integration/standard/test_metrics.py @@ -311,6 +311,9 @@ class RequestAnalyzer(object): if self.throw_on_fail: raise AttributeError + def remove_ra(self, session): + session.remove_request_init_listener(self.on_request) + def __str__(self): # just extracting request count from the size stats (which are recorded on all requests) request_sizes = dict(self.requests) @@ -357,6 +360,7 @@ class MetricsRequestSize(BasicExistingKeyspaceUnitTestCase): self.assertTrue(self.wait_for_count(ra, 10)) self.assertTrue(self.wait_for_count(ra, 3, error=True)) + ra.remove_ra(self.session) # Make sure a poorly coded RA doesn't cause issues RequestAnalyzer(self.session, throw_on_success=False, throw_on_fail=True) diff --git a/tests/integration/standard/test_query.py b/tests/integration/standard/test_query.py index bb63c9de..e8c9ead0 100644 --- a/tests/integration/standard/test_query.py +++ b/tests/integration/standard/test_query.py @@ -146,7 +146,7 @@ class QueryTests(BasicSharedKeyspaceUnitTestCase): response_future.result() # Fetch the client_ip from the trace. - trace = response_future.get_query_trace(max_wait=2.0) + trace = response_future.get_query_trace(max_wait=5.0) client_ip = trace.client # Ip address should be in the local_host range