From a223c3a7d89b878746b4b7841add75f23f74219c Mon Sep 17 00:00:00 2001 From: Joaquin Casares Date: Tue, 22 Apr 2014 13:00:45 -0500 Subject: [PATCH] fix loadbalancing fallback tests --- .../long/test_loadbalancingpolicies.py | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/integration/long/test_loadbalancingpolicies.py b/tests/integration/long/test_loadbalancingpolicies.py index 6c46103d..9e836ac5 100644 --- a/tests/integration/long/test_loadbalancingpolicies.py +++ b/tests/integration/long/test_loadbalancingpolicies.py @@ -359,17 +359,29 @@ class LoadBalancingPolicyTests(unittest.TestCase): self.coordinator_stats.assert_query_count_equals(self, 3, 0) self.coordinator_stats.reset_counts() + stop(2) + wait_for_down(cluster, 2, wait=True) + + try: + self._query(session, keyspace, use_prepared=use_prepared) + self.fail() + except Unavailable: + pass + + self.coordinator_stats.reset_counts() + start(2) + wait_for_up(cluster, 2, wait=True) decommission(2) wait_for_down(cluster, 2, wait=True) self._query(session, keyspace, use_prepared=use_prepared) - # TODO: this depends on the token order of the cluster; either set up - # the tokens deliberately or confirm that only one node is used and - # it's the correct replica - self.coordinator_stats.assert_query_count_equals(self, 1, 12) + results = { + self.coordinator_stats.get_query_count(1), + self.coordinator_stats.get_query_count(3) + } + self.assertEqual(results, {0, 12}) self.coordinator_stats.assert_query_count_equals(self, 2, 0) - self.coordinator_stats.assert_query_count_equals(self, 3, 0) def test_token_aware_composite_key(self): use_singledc()