Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: fix scylla_version handling #282

Merged
merged 1 commit into from
Feb 20, 2024
Merged
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
12 changes: 9 additions & 3 deletions 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)

Choose a reason for hiding this comment

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

What actions does setup perform? Because it sounds like it actually creates a new cluster (maybewithout starting it, idk), which is quite a lot of work to just get a version.
Why is this PR necessary? Did CI fail because of this, is there some issue opened?

Copy link
Author

Choose a reason for hiding this comment

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

setup is making sure the version is downloaded and in place

It's failing at any time you don't use release:5.4

We are testing daily builds in the matrix, it was for quite some time a patch there.

Again the assumption test should only work correctly with released versions only us wrong

Choose a reason for hiding this comment

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

Are the actions performed by setup performed only once when it is called multiple times?
So if we call get_scylla_version and then some other place in the code calls setup will all this work be performed once or twice?

Copy link
Author

Choose a reason for hiding this comment

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

if the version argument stay the same, it would operate only one.
we can put a lru_cache ontop of it, if you are worried by that.

Choose a reason for hiding this comment

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

If the work is performed only once per argument then it is fine imo, no need to add any cache

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,9 +379,8 @@ 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
# TODO remove second check when we stop using unstable version in CI for tablets
requires_collection_indexes = pytest.mark.skipif(SCYLLA_VERSION is not None and (len(SCYLLA_VERSION.split('/')) != 0 or Version(SCYLLA_VERSION.split(':')[1]) < Version('5.2')),
reason='Scylla supports collection indexes from 5.2 onwards')
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')
requires_java_udf = pytest.mark.skipif(SCYLLA_VERSION is not None,
Expand Down
Loading