@@ -1180,27 +1180,35 @@ def test_replicas_are_queried(self):
11801180 Then using HostFilterPolicy the replica is excluded from the considered hosts.
11811181 By checking the trace we verify that there are no more replicas.
11821182
1183+ Requires tablets feature disabled.
1184+
11831185 @since 3.5
11841186 @jira_ticket PYTHON-653
11851187 @expected_result the replicas are queried for HostFilterPolicy
11861188
11871189 @test_category metadata
11881190 """
1191+ ks_name = 'test_replicas_queried_ks'
11891192 queried_hosts = set ()
11901193 tap_profile = ExecutionProfile (
11911194 load_balancing_policy = TokenAwarePolicy (RoundRobinPolicy ())
11921195 )
11931196 with TestCluster (execution_profiles = {EXEC_PROFILE_DEFAULT : tap_profile }) as cluster :
11941197 session = cluster .connect (wait_for_all_pools = True )
1198+ session .execute ("DROP KEYSPACE IF EXISTS {}" .format (ks_name ))
1199+ session .execute (
1200+ "CREATE KEYSPACE {} WITH replication = {{'class': 'NetworkTopologyStrategy', "
1201+ "'replication_factor': '1'}} AND tablets = {{'enabled': false}}" .format (ks_name )
1202+ )
11951203 session .execute ('''
1196- CREATE TABLE test1rf .table_with_big_key (
1204+ CREATE TABLE {} .table_with_big_key (
11971205 k1 int,
11981206 k2 int,
11991207 k3 int,
12001208 k4 int,
1201- PRIMARY KEY((k1, k2, k3), k4))''' )
1202- prepared = session .prepare ("""SELECT * from test1rf .table_with_big_key
1203- WHERE k1 = ? AND k2 = ? AND k3 = ? AND k4 = ?""" )
1209+ PRIMARY KEY((k1, k2, k3), k4))''' . format ( ks_name ) )
1210+ prepared = session .prepare ("""SELECT * from {} .table_with_big_key
1211+ WHERE k1 = ? AND k2 = ? AND k3 = ? AND k4 = ?""" . format ( ks_name ) )
12041212 for i in range (10 ):
12051213 result = session .execute (prepared , (i , i , i , i ), trace = True )
12061214 trace = result .response_future .get_query_trace (query_cl = ConsistencyLevel .ALL )
@@ -1219,14 +1227,14 @@ def test_replicas_are_queried(self):
12191227 execution_profiles = {EXEC_PROFILE_DEFAULT : hfp_profile }) as cluster :
12201228
12211229 session = cluster .connect (wait_for_all_pools = True )
1222- prepared = session .prepare ("""SELECT * from test1rf .table_with_big_key
1223- WHERE k1 = ? AND k2 = ? AND k3 = ? AND k4 = ?""" )
1230+ prepared = session .prepare ("""SELECT * from {} .table_with_big_key
1231+ WHERE k1 = ? AND k2 = ? AND k3 = ? AND k4 = ?""" . format ( ks_name ) )
12241232 for _ in range (10 ):
12251233 result = session .execute (prepared , (last_i , last_i , last_i , last_i ), trace = True )
12261234 trace = result .response_future .get_query_trace (query_cl = ConsistencyLevel .ALL )
12271235 self ._assert_replica_queried (trace , only_replicas = False )
12281236
1229- session .execute (''' DROP TABLE test1rf.table_with_big_key''' )
1237+ session .execute ('DROP KEYSPACE {}' . format ( ks_name ) )
12301238
12311239 @greaterthanorequalcass30
12321240 @lessthanorequalcass40
0 commit comments