@@ -1195,27 +1195,35 @@ def test_replicas_are_queried(self):
11951195 Then using HostFilterPolicy the replica is excluded from the considered hosts.
11961196 By checking the trace we verify that there are no more replicas.
11971197
1198+ Requires tablets feature disabled.
1199+
11981200 @since 3.5
11991201 @jira_ticket PYTHON-653
12001202 @expected_result the replicas are queried for HostFilterPolicy
12011203
12021204 @test_category metadata
12031205 """
1206+ ks_name = 'test_replicas_queried_ks'
12041207 queried_hosts = set ()
12051208 tap_profile = ExecutionProfile (
12061209 load_balancing_policy = TokenAwarePolicy (RoundRobinPolicy ())
12071210 )
12081211 with TestCluster (execution_profiles = {EXEC_PROFILE_DEFAULT : tap_profile }) as cluster :
12091212 session = cluster .connect (wait_for_all_pools = True )
1213+ session .execute ("DROP KEYSPACE IF EXISTS {}" .format (ks_name ))
1214+ session .execute (
1215+ "CREATE KEYSPACE {} WITH replication = {{'class': 'NetworkTopologyStrategy', "
1216+ "'replication_factor': '1'}} AND tablets = {{'enabled': false}}" .format (ks_name )
1217+ )
12101218 session .execute ('''
1211- CREATE TABLE test1rf .table_with_big_key (
1219+ CREATE TABLE {} .table_with_big_key (
12121220 k1 int,
12131221 k2 int,
12141222 k3 int,
12151223 k4 int,
1216- PRIMARY KEY((k1, k2, k3), k4))''' )
1217- prepared = session .prepare ("""SELECT * from test1rf .table_with_big_key
1218- WHERE k1 = ? AND k2 = ? AND k3 = ? AND k4 = ?""" )
1224+ PRIMARY KEY((k1, k2, k3), k4))''' . format ( ks_name ) )
1225+ prepared = session .prepare ("""SELECT * from {} .table_with_big_key
1226+ WHERE k1 = ? AND k2 = ? AND k3 = ? AND k4 = ?""" . format ( ks_name ) )
12191227 for i in range (10 ):
12201228 result = session .execute (prepared , (i , i , i , i ), trace = True )
12211229 trace = result .response_future .get_query_trace (query_cl = ConsistencyLevel .ALL )
@@ -1234,14 +1242,14 @@ def test_replicas_are_queried(self):
12341242 execution_profiles = {EXEC_PROFILE_DEFAULT : hfp_profile }) as cluster :
12351243
12361244 session = cluster .connect (wait_for_all_pools = True )
1237- prepared = session .prepare ("""SELECT * from test1rf .table_with_big_key
1238- WHERE k1 = ? AND k2 = ? AND k3 = ? AND k4 = ?""" )
1245+ prepared = session .prepare ("""SELECT * from {} .table_with_big_key
1246+ WHERE k1 = ? AND k2 = ? AND k3 = ? AND k4 = ?""" . format ( ks_name ) )
12391247 for _ in range (10 ):
12401248 result = session .execute (prepared , (last_i , last_i , last_i , last_i ), trace = True )
12411249 trace = result .response_future .get_query_trace (query_cl = ConsistencyLevel .ALL )
12421250 self ._assert_replica_queried (trace , only_replicas = False )
12431251
1244- session .execute (''' DROP TABLE test1rf.table_with_big_key''' )
1252+ session .execute ('DROP KEYSPACE {}' . format ( ks_name ) )
12451253
12461254 @greaterthanorequalcass30
12471255 @lessthanorequalcass40
0 commit comments