Skip to content

Commit

Permalink
tests: fix scylla_version handling
Browse files Browse the repository at this point in the history
test shouldn't assume `SCYLLA_VERSION` is an actual version
and should be using ccmlib to read the actual versions strings
  • Loading branch information
fruch committed Dec 25, 2023
1 parent e7532b1 commit 7530db1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from cassandra import ProtocolVersion

try:
import ccmlib
from ccmlib.dse_cluster import DseCluster
from ccmlib.cluster import Cluster as CCMCluster
from ccmlib.scylla_cluster import ScyllaCluster as CCMScyllaCluster
Expand Down Expand Up @@ -97,6 +98,12 @@ def get_server_versions():
return (cass_version, cql_version)


def get_scylla_version(scylla_ccm_version_string):
""" get scylla version from ccm before starting a cluster"""
ccm_repo_cache_dir, _ = ccmlib.scylla_repository.setup(version=scylla_ccm_version_string)
return ccmlib.common.get_version_from_build(ccm_repo_cache_dir)


def _tuple_version(version_string):
if '-' in version_string:
version_string = version_string[:version_string.index('-')]
Expand Down Expand Up @@ -372,7 +379,7 @@ def _id_and_mark(f):
# 1. unittest doesn't skip setUpClass when used on class and we need it sometimes
# 2. unittest doesn't have conditional xfail, and I prefer to use pytest than custom decorator
# 3. unittest doesn't have a reason argument, so you don't see the reason in pytest report
requires_collection_indexes = pytest.mark.skipif(SCYLLA_VERSION is not None and Version(SCYLLA_VERSION.split(':')[1]) < Version('5.2'),
requires_collection_indexes = pytest.mark.skipif(SCYLLA_VERSION is not None and Version(get_scylla_version(SCYLLA_VERSION)) < Version('5.2'),
reason='Scylla supports collection indexes from 5.2 onwards')
requires_custom_indexes = pytest.mark.skipif(SCYLLA_VERSION is not None,
reason='Scylla does not support SASI or any other CUSTOM INDEX class')
Expand Down

0 comments on commit 7530db1

Please sign in to comment.