Various test fixes

This commit is contained in:
GregBestland
2016-09-22 15:18:04 -05:00
parent f19ae5a0af
commit a47a06895d
4 changed files with 10 additions and 3 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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