Various test fixes
This commit is contained in:
		@@ -334,6 +334,9 @@ class ConnectivityTest(unittest.TestCase):
 | 
				
			|||||||
        hosts = cluster.metadata.all_hosts()
 | 
					        hosts = cluster.metadata.all_hosts()
 | 
				
			||||||
        address = hosts[0].address
 | 
					        address = hosts[0].address
 | 
				
			||||||
        node_to_stop = int(address.split('.')[-1:][0])
 | 
					        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:
 | 
					        try:
 | 
				
			||||||
            force_stop(node_to_stop)
 | 
					            force_stop(node_to_stop)
 | 
				
			||||||
            wait_for_down(cluster, node_to_stop)
 | 
					            wait_for_down(cluster, node_to_stop)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1035,12 +1035,12 @@ class HostStateTest(unittest.TestCase):
 | 
				
			|||||||
        @test_category connection
 | 
					        @test_category connection
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        with Cluster(protocol_version=PROTOCOL_VERSION) as cluster:
 | 
					        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]
 | 
					            random_host = cluster.metadata.all_hosts()[0]
 | 
				
			||||||
            cluster.on_down(random_host, False)
 | 
					            cluster.on_down(random_host, False)
 | 
				
			||||||
            for _ in range(10):
 | 
					            for _ in range(10):
 | 
				
			||||||
                new_host = cluster.metadata.all_hosts()[0]
 | 
					                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)
 | 
					                time.sleep(.01)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            pool = session._pools.get(random_host)
 | 
					            pool = session._pools.get(random_host)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -311,6 +311,9 @@ class RequestAnalyzer(object):
 | 
				
			|||||||
        if self.throw_on_fail:
 | 
					        if self.throw_on_fail:
 | 
				
			||||||
            raise AttributeError
 | 
					            raise AttributeError
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def remove_ra(self, session):
 | 
				
			||||||
 | 
					        session.remove_request_init_listener(self.on_request)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __str__(self):
 | 
					    def __str__(self):
 | 
				
			||||||
        # just extracting request count from the size stats (which are recorded on all requests)
 | 
					        # just extracting request count from the size stats (which are recorded on all requests)
 | 
				
			||||||
        request_sizes = dict(self.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, 10))
 | 
				
			||||||
        self.assertTrue(self.wait_for_count(ra, 3, error=True))
 | 
					        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
 | 
					        # Make sure a poorly coded RA doesn't cause issues
 | 
				
			||||||
        RequestAnalyzer(self.session, throw_on_success=False, throw_on_fail=True)
 | 
					        RequestAnalyzer(self.session, throw_on_success=False, throw_on_fail=True)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -146,7 +146,7 @@ class QueryTests(BasicSharedKeyspaceUnitTestCase):
 | 
				
			|||||||
        response_future.result()
 | 
					        response_future.result()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Fetch the client_ip from the trace.
 | 
					        # 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
 | 
					        client_ip = trace.client
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Ip address should be in the local_host range
 | 
					        # Ip address should be in the local_host range
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user