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'} AND tablets = {'enabled': false}'''
execute_with_long_wait_retry(session, ddl)

ddl_3f = '''
Expand Down Expand Up @@ -779,7 +779,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': 'SimpleStrategy', 'replication_factor': '{1}'}} AND tablets = {{'enabled': false}}".format(cls.ks_name, rf)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This one too

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

it's BasicKeyspaceUnitTestCase so unit test, I only changed code related to integration tests in this PR

execute_with_long_wait_retry(cls.session, ddl)

@classmethod
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 @@ -729,7 +729,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 @@ -1137,7 +1137,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 @@ -1173,7 +1173,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
4 changes: 2 additions & 2 deletions tests/integration/standard/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,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 @@ -1491,7 +1491,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'} AND tablets = {'enabled': false}")
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
20 changes: 10 additions & 10 deletions tests/integration/standard/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ def test_refresh_schema_metadata(self):
assert "new_keyspace" not in cluster2.metadata.keyspaces

# Cluster metadata modification
self.session.execute("CREATE KEYSPACE new_keyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}")
self.session.execute("CREATE KEYSPACE new_keyspace WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}")
assert "new_keyspace" not in cluster2.metadata.keyspaces

cluster2.refresh_schema_metadata()
Expand Down Expand Up @@ -1077,7 +1077,7 @@ def test_metadata_pagination_keyspaces(self):

for ks in keyspaces:
self.session.execute(
f"CREATE KEYSPACE IF NOT EXISTS {ks} WITH REPLICATION = {{ 'class' : 'SimpleStrategy', 'replication_factor' : 3 }}"
f"CREATE KEYSPACE IF NOT EXISTS {ks} WITH REPLICATION = {{ 'class' : 'NetworkTopologyStrategy', 'replication_factor' : 3 }}"
)

self.cluster.schema_metadata_page_size = 2000
Expand Down Expand Up @@ -1138,7 +1138,7 @@ def test_export_keyspace_schema_udts(self):

session.execute("""
CREATE KEYSPACE export_udts
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}
AND durable_writes = true;
""")
session.execute("""
Expand All @@ -1162,7 +1162,7 @@ def test_export_keyspace_schema_udts(self):
addresses map<text, frozen<address>>)
""")

expected_prefix = """CREATE KEYSPACE export_udts WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;
expected_prefix = """CREATE KEYSPACE export_udts WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'} AND durable_writes = true;

CREATE TYPE export_udts.street (
street_number int,
Expand Down Expand Up @@ -1212,7 +1212,7 @@ def test_case_sensitivity(self):
session.execute("DROP KEYSPACE IF EXISTS {0}".format(ksname))
session.execute("""
CREATE KEYSPACE "%s"
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'} AND tablets = {'enabled': false}
""" % (ksname,))
session.execute("""
CREATE TABLE "%s"."%s" (
Expand Down Expand Up @@ -1256,7 +1256,7 @@ def test_already_exists_exceptions(self):

ddl = '''
CREATE KEYSPACE %s
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'}'''
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '3'}'''
with pytest.raises(AlreadyExists):
session.execute(ddl % ksname)

Expand Down Expand Up @@ -1387,7 +1387,7 @@ def setUp(self):
self.session = self.cluster.connect()
name = self._testMethodName.lower()
crt_ks = '''
CREATE KEYSPACE %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1} AND durable_writes = true''' % name
CREATE KEYSPACE %s WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1} AND durable_writes = true''' % name
self.session.execute(crt_ks)

def tearDown(self):
Expand Down Expand Up @@ -1437,7 +1437,7 @@ def setup_class(cls):
cls.session.execute(
"""
CREATE KEYSPACE %s
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'} AND tablets = {'enabled': false};
""" % cls.keyspace_name)
cls.session.set_keyspace(cls.keyspace_name)
except Exception:
Expand Down Expand Up @@ -1540,7 +1540,7 @@ def setup_class(cls):
cls.cluster = TestCluster()
cls.keyspace_name = cls.__name__.lower()
cls.session = cls.cluster.connect()
cls.session.execute("CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}" % cls.keyspace_name)
cls.session.execute("CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1}" % cls.keyspace_name)
cls.session.set_keyspace(cls.keyspace_name)
cls.keyspace_function_meta = cls.cluster.metadata.keyspaces[cls.keyspace_name].functions
cls.keyspace_aggregate_meta = cls.cluster.metadata.keyspaces[cls.keyspace_name].aggregates
Expand Down Expand Up @@ -2007,7 +2007,7 @@ def setup_class(cls):
cls.cluster = TestCluster()
cls.keyspace_name = cls.__name__.lower()
cls.session = cls.cluster.connect()
cls.session.execute("CREATE KEYSPACE %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}" % cls.keyspace_name)
cls.session.execute("CREATE KEYSPACE %s WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'} AND tablets = {'enabled': false}" % cls.keyspace_name)
cls.session.set_keyspace(cls.keyspace_name)
connection = cls.cluster.control_connection._connection

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/standard/test_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@ def test_exponential_retries(self):
self.session.execute(
"""
CREATE KEYSPACE preparedtests
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}
""")
4 changes: 2 additions & 2 deletions tests/integration/standard/test_prepared_statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_basic(self):
self.session.execute(
"""
CREATE KEYSPACE preparedtests
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}
""")

self.session.set_keyspace("preparedtests")
Expand Down Expand Up @@ -437,7 +437,7 @@ def test_fail_if_different_query_id_on_reprepare(self):
keyspace = "test_fail_if_different_query_id_on_reprepare"
self.session.execute(
"CREATE KEYSPACE IF NOT EXISTS {} WITH replication = "
"{{'class': 'SimpleStrategy', 'replication_factor': 1}}".format(keyspace)
"{{'class': 'NetworkTopologyStrategy', 'replication_factor': 1}}".format(keyspace)
)
self.session.execute("CREATE TABLE IF NOT EXISTS {}.foo(k int PRIMARY KEY)".format(keyspace))
prepared = self.session.prepare("SELECT * FROM {}.foo WHERE k=?".format(keyspace))
Expand Down
18 changes: 15 additions & 3 deletions tests/integration/standard/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from cassandra.policies import HostDistance, RoundRobinPolicy, WhiteListRoundRobinPolicy
from tests.integration import use_singledc, PROTOCOL_VERSION, BasicSharedKeyspaceUnitTestCase, \
greaterthanprotocolv3, MockLoggingHandler, get_supported_protocol_versions, local, get_cluster, setup_keyspace, \
USE_CASS_EXTERNAL, greaterthanorequalcass40, TestCluster, xfail_scylla
USE_CASS_EXTERNAL, greaterthanorequalcass40, TestCluster, xfail_scylla, xfail_scylla_version_lt
from tests import notwindows
from tests.integration import greaterthanorequalcass30, get_node
from tests.util import assertListEqual, wait_until
Expand Down Expand Up @@ -804,6 +804,9 @@ def setUp(self):
def tearDown(self):
self.cluster.shutdown()

@xfail_scylla_version_lt(reason='scylladb/scylladb#18068 - LWT is not yet supported with tablets',
oss_scylla_version='6.4', ent_scylla_version='2025.4',
raises=InvalidRequest)
def test_conditional_update(self):
self.session.execute("INSERT INTO test3rf.test (k, v) VALUES (0, 0)")
statement = SimpleStatement(
Expand All @@ -828,6 +831,9 @@ def test_conditional_update(self):
assert result
assert result.one().applied

@xfail_scylla_version_lt(reason='scylladb/scylladb#18068 - LWT is not yet supported with tablets',
oss_scylla_version='6.4', ent_scylla_version='2025.4',
raises=InvalidRequest)
def test_conditional_update_with_prepared_statements(self):
self.session.execute("INSERT INTO test3rf.test (k, v) VALUES (0, 0)")
statement = self.session.prepare(
Expand All @@ -850,6 +856,9 @@ def test_conditional_update_with_prepared_statements(self):
assert result
assert result.one().applied

@xfail_scylla_version_lt(reason='scylladb/scylladb#18068 - LWT is not yet supported with tablets',
oss_scylla_version='6.4', ent_scylla_version='2025.4',
raises=InvalidRequest)
def test_conditional_update_with_batch_statements(self):
self.session.execute("INSERT INTO test3rf.test (k, v) VALUES (0, 0)")
statement = BatchStatement(serial_consistency_level=ConsistencyLevel.SERIAL)
Expand Down Expand Up @@ -915,6 +924,9 @@ def tearDown(self):
self.session.execute("DROP TABLE test3rf.lwt_clustering")
self.cluster.shutdown()

@xfail_scylla_version_lt(reason='scylladb/scylladb#18068 - LWT is not yet supported with tablets',
oss_scylla_version='6.4', ent_scylla_version='2025.4',
raises=AttributeError)
def test_no_connection_refused_on_timeout(self):
"""
Test for PYTHON-91 "Connection closed after LWT timeout"
Expand Down Expand Up @@ -1359,12 +1371,12 @@ def setUpClass(cls):
cls.table_name = "table_query_keyspace_tests"

ddl = """CREATE KEYSPACE {0} WITH replication =
{{'class': 'SimpleStrategy',
{{'class': 'NetworkTopologyStrategy',
'replication_factor': '{1}'}}""".format(cls.ks_name, 1)
cls.session.execute(ddl)

ddl = """CREATE KEYSPACE {0} WITH replication =
{{'class': 'SimpleStrategy',
{{'class': 'NetworkTopologyStrategy',
'replication_factor': '{1}'}}""".format(cls.alternative_ks, 1)
cls.session.execute(ddl)

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/standard/test_rate_limit_exceeded.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_rate_limit_exceeded(self):
self.session.execute(
"""
CREATE KEYSPACE IF NOT EXISTS ratetests
WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1}
WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1}
""")

self.session.execute("USE ratetests")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/standard/test_shard_aware.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def create_ks_and_cf(self):
self.session.execute(
"""
CREATE KEYSPACE preparedtests
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'}
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '3'}
""")

self.session.execute("USE preparedtests")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/standard/test_tablets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def setup_module():
use_cluster('tablets', [3], start=True)
use_cluster('tablets', [3], start=True, set_keyspace=False)


class TestTabletsIntegration:
Expand Down
Loading
Loading