Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,17 +651,17 @@ def setup_keyspace(ipformat=None, protocol_version=None, port=9042):

ddl = '''
CREATE KEYSPACE test3rf
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'}'''
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '3'}'''
execute_with_long_wait_retry(session, ddl)

ddl = '''
CREATE KEYSPACE test2rf
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '2'}'''
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '2'}'''
execute_with_long_wait_retry(session, ddl)

ddl = '''
CREATE KEYSPACE test1rf
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}'''
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}'''
execute_with_long_wait_retry(session, ddl)

ddl_3f = '''
Expand Down Expand Up @@ -774,7 +774,7 @@ def drop_keyspace(cls):

@classmethod
def create_keyspace(cls, rf):
ddl = "CREATE KEYSPACE {0} WITH replication = {{'class': 'SimpleStrategy', 'replication_factor': '{1}'}}".format(cls.ks_name, rf)
ddl = "CREATE KEYSPACE {0} WITH replication = {{'class': 'NetworkTopologyStrategy', 'replication_factor': '{1}'}}".format(cls.ks_name, rf)
execute_with_long_wait_retry(cls.session, ddl)

@classmethod
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/cqlengine/query/test_named.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from tests.integration.cqlengine.query.test_queryset import BaseQuerySetUsage


from tests.integration import BasicSharedKeyspaceUnitTestCase, greaterthanorequalcass30, requires_collection_indexes
from tests.integration import BasicSharedKeyspaceUnitTestCase, greaterthanorequalcass30, requires_collection_indexes, xfail_scylla_version_lt
import pytest


Expand Down Expand Up @@ -292,6 +292,8 @@ def tearDownClass(cls):
super(TestNamedWithMV, cls).tearDownClass()

@greaterthanorequalcass30
@xfail_scylla_version_lt(reason='scylladb/scylladb#22677 - Materialized views and secondary indexes are not supported on base tables with tablets.',
scylla_version='2026.1')
@execute_count(5)
Comment on lines 293 to 297
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated: the oss_scylla_version parameter no longer makes sense. In a separate PR we should modify xfail_scylla_version_lt so that it takes only one scylla_version parameter.

def test_named_table_with_mv(self):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ColumnEncryptionPolicyTest(unittest.TestCase):

def _recreate_keyspace(self, session):
session.execute("drop keyspace if exists foo")
session.execute("CREATE KEYSPACE foo WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}")
session.execute("CREATE KEYSPACE foo WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}")
session.execute("CREATE TABLE foo.bar(encrypted blob, unencrypted int, primary key(unencrypted))")

def _create_policy(self, key, iv = None):
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/standard/test_client_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ def test_queries_succeed_through_proxy(self):
session = cluster.connect()
session.execute(
"CREATE KEYSPACE IF NOT EXISTS test_cr_ks "
"WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3}"
"WITH replication = {'class':'NetworkTopologyStrategy', 'replication_factor': 3}"
)
session.execute(
"CREATE TABLE IF NOT EXISTS test_cr_ks.t (k int PRIMARY KEY, v text)"
Expand Down Expand Up @@ -1154,7 +1154,7 @@ def tearDownClass(cls):
def test_should_survive_full_node_replacement_through_nlb(self):
"""
1. Start with 3 nodes behind the NLB
2. Bootstrap 2 new nodes, add to NLB, update routes
2. Bootstrap 3 new nodes, add to NLB, update routes
3. Decommission the original 3 nodes one-by-one, updating NLB/routes
4. Verify the session survives with only new nodes
"""
Expand Down Expand Up @@ -1190,7 +1190,7 @@ def test_should_survive_full_node_replacement_through_nlb(self):
len(original_node_ids))

# ---- Stage 3: Bootstrap new nodes ----
new_node_ids = [max(original_node_ids) + 1, max(original_node_ids) + 2]
new_node_ids = [max(original_node_ids) + 1, max(original_node_ids) + 2, max(original_node_ids) + 3]
log.info("Stage 3: Adding nodes %s", new_node_ids)
ccm_cluster = get_cluster()

Expand Down
26 changes: 17 additions & 9 deletions tests/integration/standard/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def test_basic(self):
result = execute_until_pass(session,
"""
CREATE KEYSPACE clustertests
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}
""")
assert not result

Expand Down Expand Up @@ -1195,27 +1195,35 @@ def test_replicas_are_queried(self):
Then using HostFilterPolicy the replica is excluded from the considered hosts.
By checking the trace we verify that there are no more replicas.

Requires tablets feature disabled.

@since 3.5
@jira_ticket PYTHON-653
@expected_result the replicas are queried for HostFilterPolicy

@test_category metadata
"""
ks_name = 'test_replicas_queried_ks'
queried_hosts = set()
tap_profile = ExecutionProfile(
load_balancing_policy=TokenAwarePolicy(RoundRobinPolicy())
)
with TestCluster(execution_profiles={EXEC_PROFILE_DEFAULT: tap_profile}) as cluster:
session = cluster.connect(wait_for_all_pools=True)
session.execute("DROP KEYSPACE IF EXISTS {}".format(ks_name))
session.execute(
"CREATE KEYSPACE {} WITH replication = {{'class': 'NetworkTopologyStrategy', "
"'replication_factor': '1'}} AND tablets = {{'enabled': false}}".format(ks_name)
)
session.execute('''
CREATE TABLE test1rf.table_with_big_key (
CREATE TABLE {}.table_with_big_key (
k1 int,
k2 int,
k3 int,
k4 int,
PRIMARY KEY((k1, k2, k3), k4))''')
prepared = session.prepare("""SELECT * from test1rf.table_with_big_key
WHERE k1 = ? AND k2 = ? AND k3 = ? AND k4 = ?""")
PRIMARY KEY((k1, k2, k3), k4))'''.format(ks_name))
prepared = session.prepare("""SELECT * from {}.table_with_big_key
WHERE k1 = ? AND k2 = ? AND k3 = ? AND k4 = ?""".format(ks_name))
for i in range(10):
result = session.execute(prepared, (i, i, i, i), trace=True)
trace = result.response_future.get_query_trace(query_cl=ConsistencyLevel.ALL)
Expand All @@ -1234,14 +1242,14 @@ def test_replicas_are_queried(self):
execution_profiles={EXEC_PROFILE_DEFAULT: hfp_profile}) as cluster:

session = cluster.connect(wait_for_all_pools=True)
prepared = session.prepare("""SELECT * from test1rf.table_with_big_key
WHERE k1 = ? AND k2 = ? AND k3 = ? AND k4 = ?""")
prepared = session.prepare("""SELECT * from {}.table_with_big_key
WHERE k1 = ? AND k2 = ? AND k3 = ? AND k4 = ?""".format(ks_name))
for _ in range(10):
result = session.execute(prepared, (last_i, last_i, last_i, last_i), trace=True)
trace = result.response_future.get_query_trace(query_cl=ConsistencyLevel.ALL)
self._assert_replica_queried(trace, only_replicas=False)

session.execute('''DROP TABLE test1rf.table_with_big_key''')
session.execute('DROP KEYSPACE {}'.format(ks_name))

@greaterthanorequalcass30
@lessthanorequalcass40
Expand Down Expand Up @@ -1506,7 +1514,7 @@ def test_prepare_on_ignored_hosts(self):
hosts = cluster.metadata.all_hosts()
session.execute("CREATE KEYSPACE clustertests "
"WITH replication = "
"{'class': 'SimpleStrategy', 'replication_factor': '1'}")
"{'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}")
session.execute("CREATE TABLE clustertests.tab (a text, PRIMARY KEY (a))")
# assign to an unused variable so cluster._prepared_statements retains
# reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_schema_change_after_node_kill(self):
"DROP KEYSPACE IF EXISTS ks_deadlock;")
self.session.execute(
"CREATE KEYSPACE IF NOT EXISTS ks_deadlock "
"WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '2' };")
"WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '2' };")
self.session.set_keyspace('ks_deadlock')
self.session.execute("CREATE TABLE IF NOT EXISTS some_table(k int, c int, v int, PRIMARY KEY (k, v));")
self.session.execute("INSERT INTO some_table (k, c, v) VALUES (1, 2, 3);")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/standard/test_control_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_drop_keyspace(self):
self.session = self.cluster.connect()
self.session.execute("""
CREATE KEYSPACE keyspacetodrop
WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor': '1' }
WITH replication = { 'class' : 'NetworkTopologyStrategy', 'replication_factor': '1' }
""")
self.session.set_keyspace("keyspacetodrop")
self.session.execute("CREATE TYPE user (age int, name text)")
Expand Down
11 changes: 6 additions & 5 deletions tests/integration/standard/test_custom_protocol_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ class CustomProtocolHandlerTest(unittest.TestCase):
def setUpClass(cls):
cls.cluster = TestCluster()
cls.session = cls.cluster.connect()
cls.session.execute("CREATE KEYSPACE custserdes WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor': '1'}")
cls.session.execute("CREATE KEYSPACE custserdes WITH replication = { 'class' : 'NetworkTopologyStrategy', 'replication_factor': '1'}")
cls.session.set_keyspace("custserdes")
cls.session.execute("CREATE TABLE IF NOT EXISTS custserdes.test (k int PRIMARY KEY, v int)")

@classmethod
def tearDownClass(cls):
Expand Down Expand Up @@ -165,7 +166,7 @@ def test_protocol_divergence_v5_fail_by_flag_uses_int(self):
int_flag=False)

def _send_query_message(self, session, timeout, **kwargs):
query = "SELECT * FROM test3rf.test"
query = "SELECT * FROM custserdes.test"
message = QueryMessage(query=query, **kwargs)
future = ResponseFuture(session, message, query=None, timeout=timeout)
future.send_request()
Expand All @@ -175,8 +176,8 @@ def _protocol_divergence_fail_by_flag_uses_int(self, version, uses_int_query_fla
cluster = TestCluster(protocol_version=version, allow_beta_protocol_version=beta)
session = cluster.connect()

query_one = SimpleStatement("INSERT INTO test3rf.test (k, v) VALUES (1, 1)")
query_two = SimpleStatement("INSERT INTO test3rf.test (k, v) VALUES (2, 2)")
query_one = SimpleStatement("INSERT INTO custserdes.test (k, v) VALUES (1, 1)")
query_two = SimpleStatement("INSERT INTO custserdes.test (k, v) VALUES (2, 2)")

execute_with_long_wait_retry(session, query_one)
execute_with_long_wait_retry(session, query_two)
Expand All @@ -190,7 +191,7 @@ def _protocol_divergence_fail_by_flag_uses_int(self, version, uses_int_query_fla
# This means the flag are not handled as they are meant by the server if uses_int=False
assert response.has_more_pages == uses_int_query_flag

execute_with_long_wait_retry(session, SimpleStatement("TRUNCATE test3rf.test"))
execute_with_long_wait_retry(session, SimpleStatement("TRUNCATE custserdes.test"))
cluster.shutdown()


Expand Down
4 changes: 2 additions & 2 deletions tests/integration/standard/test_cython_protocol_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def setUpClass(cls):
cls.cluster = TestCluster()
cls.session = cls.cluster.connect()
cls.session.execute("CREATE KEYSPACE testspace WITH replication = "
"{ 'class' : 'SimpleStrategy', 'replication_factor': '1'}")
"{ 'class' : 'NetworkTopologyStrategy', 'replication_factor': '1'}")
cls.session.set_keyspace("testspace")
cls.colnames = create_table_with_all_types("test_table", cls.session, cls.N_ITEMS)

Expand Down Expand Up @@ -225,7 +225,7 @@ def setUpClass(cls):
cls.cluster = TestCluster()
cls.session = cls.cluster.connect()
cls.session.execute("CREATE KEYSPACE IF NOT EXISTS test_wide_table WITH replication = "
"{ 'class' : 'SimpleStrategy', 'replication_factor': '1'}")
"{ 'class' : 'NetworkTopologyStrategy', 'replication_factor': '1'}")
cls.session.set_keyspace("test_wide_table")

# Create a wide table with many int columns
Expand Down
Loading
Loading