Skip to content
Merged
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
11 changes: 11 additions & 0 deletions tests/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,17 @@ def xfail_scylla_version_lt(reason, scylla_version, *args, **kwargs):
return pytest.mark.xfail(current_version < Version(scylla_version), reason=reason, *args, **kwargs)


def get_tablets_disabled_ddl_suffix(scylla_version='2026.1'):
"""
Returns DDL option string for disabling tablets on ScyllaDB versions older than scylla_version.
Used to work around features not yet supported with tablets (e.g. MVs, secondary indexes, counters).
:param scylla_version: str, version from which tablets support the feature
"""
if SCYLLA_VERSION is not None and Version(get_scylla_version(SCYLLA_VERSION)) < Version(scylla_version):
return " AND tablets = {'enabled': false}"
return ""


def skip_scylla_version_lt(reason, scylla_version):
"""
Skip tests on scylla versions older than the specified thresholds.
Expand Down
10 changes: 7 additions & 3 deletions 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, xfail_scylla_version_lt
from tests.integration import BasicSharedKeyspaceUnitTestCase, greaterthanorequalcass30, requires_collection_indexes, get_tablets_disabled_ddl_suffix, execute_with_long_wait_retry
import pytest


Expand Down Expand Up @@ -280,6 +280,12 @@ def test_get_multipleobjects_exception(self):

class TestNamedWithMV(BasicSharedKeyspaceUnitTestCase):

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

@classmethod
def setUpClass(cls):
super(TestNamedWithMV, cls).setUpClass()
Expand All @@ -292,8 +298,6 @@ 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)
def test_named_table_with_mv(self):
"""
Expand Down
60 changes: 29 additions & 31 deletions tests/integration/standard/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
lessthancass40,
TestCluster, requires_java_udf, requires_composite_type,
requires_collection_indexes, SCYLLA_VERSION, xfail_scylla, xfail_scylla_version_lt,
requirescompactstorage)
requirescompactstorage, get_tablets_disabled_ddl_suffix, execute_with_long_wait_retry)

from tests.util import wait_until, assertRegex, assertDictEqual, assertListEqual, assert_startswith_diff

Expand Down Expand Up @@ -141,6 +141,12 @@ def test_bad_contact_point(self):

class SchemaMetadataTests(BasicSegregatedKeyspaceUnitTestCase):

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

def test_schema_metadata_disable(self):
"""
Checks to ensure that schema metadata_enabled, and token_metadata_enabled
Expand Down Expand Up @@ -448,8 +454,6 @@ def test_dense_compact_storage(self):
tablemeta = self.get_table_metadata()
self.check_create_statement(tablemeta, create_statement)

@xfail_scylla_version_lt(reason='scylladb/scylladb#22677 - Counters are not yet supported with tablets',
scylla_version="2026.1")
def test_counter(self):
create_statement = (
"CREATE TABLE {keyspace}.{table} ("
Expand Down Expand Up @@ -724,8 +728,6 @@ def test_refresh_table_metadata(self):
cluster2.shutdown()

@greaterthanorequalcass30
@xfail_scylla_version_lt(reason='scylladb/scylladb#22677 - Secondary indexes are not supported on base tables with tablets',
scylla_version="2026.1")
def test_refresh_metadata_for_mv(self):
"""
test for synchronously refreshing materialized view metadata
Expand Down Expand Up @@ -935,8 +937,6 @@ def test_refresh_user_aggregate_metadata(self):

@greaterthanorequalcass30
@requires_collection_indexes
@xfail_scylla_version_lt(reason='scylladb/scylladb#22677 - Secondary indexes are not supported on base tables with tablets',
scylla_version="2026.1")
def test_multiple_indices(self):
"""
test multiple indices on the same column.
Expand Down Expand Up @@ -970,8 +970,6 @@ def test_multiple_indices(self):
assert index_2.keyspace_name == "schemametadatatests"

@greaterthanorequalcass30
@xfail_scylla_version_lt(reason='scylladb/scylladb#22677 - Secondary indexes are not supported on base tables with tablets',
scylla_version="2026.1")
def test_table_extensions(self):
s = self.session
ks = self.keyspace_name
Expand Down Expand Up @@ -1204,8 +1202,6 @@ def test_export_keyspace_schema_udts(self):
cluster.shutdown()

@greaterthancass21
@xfail_scylla_version_lt(reason='scylladb/scylladb#22677 - Secondary indexes are not supported on base tables with tablets',
scylla_version="2026.1")
def test_case_sensitivity(self):
"""
Test that names that need to be escaped in CREATE statements are
Expand All @@ -1218,10 +1214,9 @@ def test_case_sensitivity(self):
cfname = 'AnInterestingTable'

session.execute("DROP KEYSPACE IF EXISTS {0}".format(ksname))
session.execute("""
CREATE KEYSPACE "%s"
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}
""" % (ksname,))
session.execute(
("CREATE KEYSPACE \"%s\" WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}" +
get_tablets_disabled_ddl_suffix()) % (ksname,))
session.execute("""
CREATE TABLE "%s"."%s" (
k int,
Expand Down Expand Up @@ -1442,11 +1437,9 @@ def setup_class(cls):
if cls.keyspace_name in cls.cluster.metadata.keyspaces:
cls.session.execute("DROP KEYSPACE %s" % cls.keyspace_name)

cls.session.execute(
"""
CREATE KEYSPACE %s
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'};
""" % cls.keyspace_name)
ddl = ("CREATE KEYSPACE %s WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}" +
get_tablets_disabled_ddl_suffix())
cls.session.execute(ddl % cls.keyspace_name)
cls.session.set_keyspace(cls.keyspace_name)
except Exception:
cls.cluster.shutdown()
Expand All @@ -1465,8 +1458,6 @@ def create_basic_table(self):
def drop_basic_table(self):
self.session.execute("DROP TABLE %s" % self.table_name)

@xfail_scylla_version_lt(reason='scylladb/scylladb#22677 - Secondary indexes are not supported on base tables with tablets',
scylla_version="2026.1")
def test_index_updates(self):
self.create_basic_table()

Expand Down Expand Up @@ -1508,8 +1499,6 @@ def test_index_updates(self):
assert 'a_idx' not in ks_meta.indexes
assert 'b_idx' not in ks_meta.indexes

@xfail_scylla_version_lt(reason='scylladb/scylladb#22677 - Secondary indexes are not supported on base tables with tablets',
scylla_version="2026.1")
def test_index_follows_alter(self):
self.create_basic_table()

Expand Down Expand Up @@ -2019,7 +2008,8 @@ 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': 'NetworkTopologyStrategy', 'replication_factor': '1'}" % cls.keyspace_name)
ddl = "CREATE KEYSPACE %s WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}" + get_tablets_disabled_ddl_suffix()
cls.session.execute(ddl % cls.keyspace_name)
cls.session.set_keyspace(cls.keyspace_name)
connection = cls.cluster.control_connection._connection

Expand Down Expand Up @@ -2051,8 +2041,6 @@ def test_bad_table(self):
assert m._exc_info[0] is self.BadMetaException
assert "/*\nWarning:" in m.export_as_string()

@xfail_scylla_version_lt(reason='scylladb/scylladb#22677 - Secondary indexes are not supported on base tables with tablets',
scylla_version="2026.1")
def test_bad_index(self):
self.session.execute('CREATE TABLE %s (k int PRIMARY KEY, v int)' % self.function_name)
self.session.execute('CREATE INDEX ON %s(v)' % self.function_name)
Expand Down Expand Up @@ -2144,10 +2132,15 @@ def test_dct_alias(self):


@greaterthanorequalcass30
@xfail_scylla_version_lt(reason='scylladb/scylladb#22677 - Secondary indexes are not supported on base tables with tablets',
scylla_version="2026.1")
class MaterializedViewMetadataTestSimple(BasicSharedKeyspaceUnitTestCase):

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


def setUp(self):
self.session.execute("CREATE TABLE {0}.{1} (pk int PRIMARY KEY, c int)".format(self.keyspace_name, self.function_table_name))
self.session.execute(
Expand Down Expand Up @@ -2234,9 +2227,14 @@ def test_materialized_view_metadata_drop(self):


@greaterthanorequalcass30
@xfail_scylla_version_lt(reason='scylladb/scylladb#22677 - Secondary indexes are not supported on base tables with tablets',
scylla_version="2026.1")
class MaterializedViewMetadataTestComplex(BasicSegregatedKeyspaceUnitTestCase):

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

def test_create_view_metadata(self):
"""
test to ensure that materialized view metadata is properly constructed
Expand Down
11 changes: 8 additions & 3 deletions tests/integration/standard/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
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, xfail_scylla_version_lt
USE_CASS_EXTERNAL, greaterthanorequalcass40, TestCluster, xfail_scylla, xfail_scylla_version_lt, \
get_tablets_disabled_ddl_suffix, execute_with_long_wait_retry
from tests import notwindows
from tests.integration import greaterthanorequalcass30, get_node
from tests.util import assertListEqual, wait_until
Expand Down Expand Up @@ -1166,10 +1167,14 @@ def test_inherit_first_rk_prepared_param(self):


@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')
class MaterializedViewQueryTest(BasicSharedKeyspaceUnitTestCase):

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

def test_mv_filtering(self):
"""
Test to ensure that cql filtering where clauses are properly supported in the python driver.
Expand Down
Loading