Skip to content

Commit

Permalink
tests: mark test which are scylla specific
Browse files Browse the repository at this point in the history
those test can't be run ontop of cassandra
and we should mark them in a why we can skip them
  • Loading branch information
fruch committed Nov 6, 2024
1 parent 0faab66 commit 6343573
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 14 deletions.
3 changes: 2 additions & 1 deletion tests/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,13 @@ def _id_and_mark(f):
reason='Scylla does not support custom payloads. Cassandra requires native protocol v4.0+')
xfail_scylla = lambda reason, *args, **kwargs: pytest.mark.xfail(SCYLLA_VERSION is not None, reason=reason, *args, **kwargs)
incorrect_test = lambda reason='This test seems to be incorrect and should be fixed', *args, **kwargs: pytest.mark.xfail(reason=reason, *args, **kwargs)
scylla_only = pytest.mark.skipif(SCYLLA_VERSION is None, reason='Scylla only test')

pypy = unittest.skipUnless(platform.python_implementation() == "PyPy", "Test is skipped unless it's on PyPy")
requiresmallclockgranularity = unittest.skipIf("Windows" in platform.system() or "asyncore" in EVENT_LOOP_MANAGER,
"This test is not suitible for environments with large clock granularity")
requiressimulacron = unittest.skipIf(SIMULACRON_JAR is None or CASSANDRA_VERSION < Version("2.1"), "Simulacron jar hasn't been specified or C* version is 2.0")
requirecassandra = unittest.skipIf(DSE_VERSION, "Cassandra required")
requirecassandra = unittest.skipIf(DSE_VERSION or SCYLLA_VERSION, "Cassandra required")
notdse = unittest.skipIf(DSE_VERSION, "DSE not supported")
requiredse = unittest.skipUnless(DSE_VERSION, "DSE required")
requirescloudproxy = unittest.skipIf(CLOUD_PROXY_PATH is None, "Cloud Proxy path hasn't been specified")
Expand Down
3 changes: 0 additions & 3 deletions tests/integration/standard/test_custom_protocol_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def test_custom_raw_row_results_all_types(self):
self.assertEqual(len(CustomResultMessageTracked.checked_rev_row_set), len(PRIMITIVE_DATATYPES)-1)
cluster.shutdown()

@unittest.expectedFailure
@requirecassandra
@greaterthanorequalcass40
def test_protocol_divergence_v5_fail_by_continuous_paging(self):
Expand Down Expand Up @@ -168,7 +167,6 @@ def test_protocol_divergence_v4_fail_by_flag_uses_int(self):
self._protocol_divergence_fail_by_flag_uses_int(ProtocolVersion.V4, uses_int_query_flag=False,
int_flag=True)

@unittest.expectedFailure
@requirecassandra
@greaterthanorequalcass40
def test_protocol_v5_uses_flag_int(self):
Expand Down Expand Up @@ -196,7 +194,6 @@ def test_protocol_dsev1_uses_flag_int(self):
self._protocol_divergence_fail_by_flag_uses_int(ProtocolVersion.DSE_V1, uses_int_query_flag=True,
int_flag=True)

@unittest.expectedFailure
@requirecassandra
@greaterthanorequalcass40
def test_protocol_divergence_v5_fail_by_flag_uses_int(self):
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/standard/test_ip_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from cassandra.cluster import ExecutionProfile
from cassandra.policies import WhiteListRoundRobinPolicy

from tests.integration import use_cluster, get_node, get_cluster, local, TestCluster
from tests.integration import use_cluster, get_node, get_cluster, local, TestCluster, scylla_only
from tests.util import wait_until_not_raised

LOGGER = logging.getLogger(__name__)
Expand All @@ -16,6 +16,7 @@ def setup_module():
use_cluster('test_ip_change', [3], start=True)

@local
@scylla_only
class TestIpAddressChange(unittest.TestCase):
@classmethod
def setup_class(cls):
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/standard/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@

from cassandra import AlreadyExists, SignatureDescriptor, UserFunctionDescriptor, UserAggregateDescriptor
from cassandra.connection import Connection

from cassandra.encoder import Encoder
from cassandra.metadata import (IndexMetadata, Token, murmur3, Function, Aggregate, protect_name, protect_names,
RegisteredTableExtension, _RegisteredExtensionType, get_schema_parser,
group_keys_by_replica, NO_VALID_REPLICA)
from cassandra.protocol import QueryMessage, ProtocolHandler
from cassandra.util import SortedSet
from ccmlib.scylla_cluster import ScyllaCluster

from tests.integration import (get_cluster, use_singledc, PROTOCOL_VERSION, execute_until_pass,
BasicSegregatedKeyspaceUnitTestCase, BasicSharedKeyspaceUnitTestCase,
Expand Down Expand Up @@ -1207,7 +1207,7 @@ def test_export_keyspace_schema_udts(self):
cluster.shutdown()

@greaterthancass21
@pytest.mark.xfail(reason='Column name in CREATE INDEX is not quoted. It\'s a bug in driver or in Scylla')
@xfail_scylla(reason='Column name in CREATE INDEX is not quoted. It\'s a bug in driver or in Scylla')
def test_case_sensitivity(self):
"""
Test that names that need to be escaped in CREATE statements are
Expand Down Expand Up @@ -1277,13 +1277,13 @@ def test_already_exists_exceptions(self):
cluster.shutdown()

@local
@pytest.mark.xfail(reason='AssertionError: \'RAC1\' != \'r1\' - probably a bug in driver or in Scylla')
def test_replicas(self):
"""
Ensure cluster.metadata.get_replicas return correctly when not attached to keyspace
"""
if murmur3 is None:
raise unittest.SkipTest('the murmur3 extension is not available')
is_scylla = isinstance(get_cluster(), ScyllaCluster)

cluster = TestCluster()
self.assertEqual(cluster.metadata.get_replicas('test3rf', 'key'), [])
Expand All @@ -1293,7 +1293,7 @@ def test_replicas(self):
self.assertNotEqual(list(cluster.metadata.get_replicas('test3rf', b'key')), [])
host = list(cluster.metadata.get_replicas('test3rf', b'key'))[0]
self.assertEqual(host.datacenter, 'dc1')
self.assertEqual(host.rack, 'r1')
self.assertEqual(host.rack, 'RAC1' if is_scylla else 'r1')
cluster.shutdown()

def test_token_map(self):
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/standard/test_rate_limit_exceeded.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
from cassandra.cluster import Cluster
from cassandra.policies import ConstantReconnectionPolicy, RoundRobinPolicy, TokenAwarePolicy

from tests.integration import PROTOCOL_VERSION, use_cluster
from tests.integration import PROTOCOL_VERSION, use_cluster, scylla_only

LOGGER = logging.getLogger(__name__)

def setup_module():
use_cluster('rate_limit', [3], start=True)

@scylla_only
class TestRateLimitExceededException(unittest.TestCase):
@classmethod
def setup_class(cls):
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/standard/test_scylla_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from ccmlib.utils.ssl_utils import generate_ssl_stores
from ccmlib.utils.sni_proxy import refresh_certs, get_cluster_info, start_sni_proxy, create_cloud_config

from tests.integration import use_cluster
from tests.integration import use_cluster, scylla_only
from cassandra.cluster import Cluster, TwistedConnection


Expand All @@ -23,7 +23,7 @@
# need to run them with specific configuration like `gevent.monkey.patch_all()` or under async functions
# unsupported_connection_classes = [GeventConnection, AsyncioConnection, EventletConnection]


@scylla_only
class ScyllaCloudConfigTests(TestCase):
def start_cluster_with_proxy(self):
ccm_cluster = self.ccm_cluster
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/standard/test_shard_aware.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from cassandra.policies import TokenAwarePolicy, RoundRobinPolicy, ConstantReconnectionPolicy
from cassandra import OperationTimedOut, ConsistencyLevel

from tests.integration import use_cluster, get_node, PROTOCOL_VERSION
from tests.integration import use_cluster, get_node, PROTOCOL_VERSION, scylla_only

LOGGER = logging.getLogger(__name__)

Expand All @@ -42,6 +42,7 @@ def setup_module():
use_cluster('shard_aware', [3], start=True)


@scylla_only
class TestShardAwareIntegration(unittest.TestCase):
@classmethod
def setup_class(cls):
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/standard/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

from tests.integration import use_singledc, execute_until_pass, notprotocolv1, \
BasicSharedKeyspaceUnitTestCase, greaterthancass21, lessthancass30, greaterthanorequaldse51, \
DSE_VERSION, greaterthanorequalcass3_10, requiredse, TestCluster, requires_composite_type
DSE_VERSION, greaterthanorequalcass3_10, requiredse, TestCluster, requires_composite_type, scylla_only
from tests.integration.datatype_utils import update_datatypes, PRIMITIVE_DATATYPES, COLLECTION_TYPES, PRIMITIVE_DATATYPES_KEYS, \
get_sample, get_all_samples, get_collection_sample

Expand Down Expand Up @@ -704,6 +704,7 @@ def test_can_insert_tuples_with_nulls(self):
self.assertEqual(('', None, None, b''), result[0].t)
self.assertEqual(('', None, None, b''), s.execute(read)[0].t)

@scylla_only
def test_insert_collection_with_null_fails(self):
"""
NULLs in list / sets / maps are forbidden.
Expand Down

0 comments on commit 6343573

Please sign in to comment.