From f739fda8bc35fe17f33441252b58abd7b5a903b0 Mon Sep 17 00:00:00 2001 From: Adam Holmberg Date: Tue, 23 Dec 2014 16:17:35 -0600 Subject: [PATCH] Add a test for TokenAware against a local table. Fixed in 61b4fad, would previously blow up with KeyError --- .../integration/long/test_loadbalancingpolicies.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/integration/long/test_loadbalancingpolicies.py b/tests/integration/long/test_loadbalancingpolicies.py index ea1eee78..8bb9e3ca 100644 --- a/tests/integration/long/test_loadbalancingpolicies.py +++ b/tests/integration/long/test_loadbalancingpolicies.py @@ -452,6 +452,19 @@ class LoadBalancingPolicyTests(unittest.TestCase): self.coordinator_stats.assert_query_count_equals(self, 2, 0) self.coordinator_stats.assert_query_count_equals(self, 3, 12) + def test_token_aware_with_local_table(self): + use_singledc() + cluster = Cluster( + load_balancing_policy=TokenAwarePolicy(RoundRobinPolicy()), + protocol_version=PROTOCOL_VERSION) + session = cluster.connect() + + p = session.prepare("SELECT * FROM system.local WHERE key=?") + # this would blow up prior to 61b4fad + r = session.execute(p, ('local',)) + self.assertEqual(len(r), 1) + self.assertEqual(r[0].key, 'local') + def test_white_list(self): use_singledc() keyspace = 'test_white_list'