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

CI: add integration tests with python 3.13 #336

Closed
wants to merge 5 commits into from
Closed
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
20 changes: 12 additions & 8 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,27 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8.17", "3.11.4", "3.12.0b4"]
python-version: ["3.8", "3.11", "3.12", "3.13"]
event_loop_manager: ["libev", "asyncio", "asyncore"]
exclude:
- python-version: "3.12.0b4"
- python-version: "3.12"
event_loop_manager: "asyncore"
- python-version: "3.13"
event_loop_manager: "asyncore"

steps:
- uses: actions/checkout@v3
- name: setup pyenv ${{ matrix.python-version }}
uses: "gabrielfalcao/pyenv-action@v16"
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install Python
with:
default: 2.7.14
versions: ${{ matrix.python-version }}
python-version: "${{ matrix.python_version }}"
allow-prereleases: true

- name: Test with pytest
run: |
export EVENT_LOOP_MANAGER=${{ matrix.event_loop_manager }}
export SCYLLA_VERSION='release:5.1'
export SCYLLA_VERSION='release:5.4'
./ci/run_integration_test.sh tests/integration/standard/ tests/integration/cqlengine/

- name: Test tablets
Expand Down
3 changes: 2 additions & 1 deletion cassandra/cqlengine/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ def _get_index_name_by_column(table, column_name):
Find the index name for a given table and column.
"""
protected_name = metadata.protect_name(column_name)
possible_index_values = [protected_name, "values(%s)" % protected_name]
possible_index_values = [protected_name, "values(%s)" % protected_name, "keys(%s)" % protected_name]
Lorak-mmk marked this conversation as resolved.
Show resolved Hide resolved
for index_metadata in table.indexes.values():
options = dict(index_metadata.index_options)

if options.get('target') in possible_index_values:
return index_metadata.name

Expand Down
11 changes: 11 additions & 0 deletions tests/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,17 @@ def _id_and_mark(f):
requires_custom_payload = pytest.mark.skipif(SCYLLA_VERSION is not None or PROTOCOL_VERSION < 4,
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)


def xfail_scylla_version(reason, oss_scylla_version, ent_scylla_version, *args, **kwargs):

Choose a reason for hiding this comment

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

Maybe xfail_scylla_version_less_than? Current name doesn't properly convey the meaning.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, I thought maybe to support both options somehow, but I didn't had time todo so.

Copy link
Author

Choose a reason for hiding this comment

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

I think of putting the version into pytest_markeval_namespace so can use pytest.mark.xfail directly

current_version = Version(get_scylla_version(SCYLLA_VERSION) if SCYLLA_VERSION is not None else '0.0.0')
if current_version > Version("2018.1"):
lt_scylla_version = Version(ent_scylla_version)
else:
lt_scylla_version = Version(oss_scylla_version)
return pytest.mark.xfail(current_version < lt_scylla_version,
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)

pypy = unittest.skipUnless(platform.python_implementation() == "PyPy", "Test is skipped unless it's on PyPy")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class SizeTieredCompactionChangesDetectionTest(Model):

__options__ = {'compaction': {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy',
'bucket_high': '20',
'bucket_low': '10',
'bucket_low': '0.5',
'max_threshold': '200',
'min_threshold': '100',
'min_sstable_size': '1000',
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/cqlengine/query/test_queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from cassandra.util import uuid_from_time
from cassandra.cqlengine.connection import get_session
from tests.integration import PROTOCOL_VERSION, CASSANDRA_VERSION, greaterthancass20, greaterthancass21, \
greaterthanorequalcass30, TestCluster, requires_collection_indexes
greaterthanorequalcass30, TestCluster, requires_collection_indexes, xfail_scylla
from tests.integration.cqlengine import execute_count, DEFAULT_KEYSPACE


Expand Down Expand Up @@ -599,6 +599,7 @@ def test_distinct_with_explicit_count(self):

@requires_collection_indexes
class TestQuerySetOrdering(BaseQuerySetUsage):
@xfail_scylla(reason="Scylla does not support ordering on non-primary key columns: https://github.com/scylladb/python-driver/issues/343")
@execute_count(2)
def test_order_by_success_case(self):
q = TestModel.objects(test_id=0).order_by('attempt_id')
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/standard/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from tests.integration import use_cluster, get_server_versions, CASSANDRA_VERSION, \
execute_until_pass, execute_with_long_wait_retry, get_node, MockLoggingHandler, get_unsupported_lower_protocol, \
get_unsupported_upper_protocol, lessthanprotocolv3, protocolv6, local, CASSANDRA_IP, greaterthanorequalcass30, \
lessthanorequalcass40, DSE_VERSION, TestCluster, PROTOCOL_VERSION, xfail_scylla, incorrect_test
lessthanorequalcass40, DSE_VERSION, TestCluster, PROTOCOL_VERSION, xfail_scylla_version, incorrect_test
from tests.integration.util import assert_quiescent_pool_state
import sys

Expand Down Expand Up @@ -288,7 +288,8 @@ def test_protocol_negotiation(self):

cluster.shutdown()

@xfail_scylla("Failing with scylla because there is option to create a cluster with 'lower bound' protocol")
@xfail_scylla_version("Failing with scylla because there is option to create a cluster with 'lower bound' protocol",
oss_scylla_version="5.2", ent_scylla_version="2023.1")
def test_invalid_protocol_negotation(self):
"""
Test for protocol negotiation when explicit versions are set
Expand Down
7 changes: 4 additions & 3 deletions tests/integration/standard/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
greaterthancass21, assert_startswith, greaterthanorequalcass40,
greaterthanorequaldse67, lessthancass40,
TestCluster, DSE_VERSION, requires_java_udf, requires_composite_type,
requires_collection_indexes, xfail_scylla)
requires_collection_indexes, xfail_scylla, xfail_scylla_version)

from tests.util import wait_until

Expand Down Expand Up @@ -502,7 +502,7 @@ def test_indexes(self):
self.assertIn('CREATE INDEX e_index', statement)

@greaterthancass21
@requires_collection_indexes
@xfail_scylla_version('failing cause of scylladb/scylladb#19278', oss_scylla_version='6.1', ent_scylla_version='2025.1')
def test_collection_indexes(self):

self.session.execute("CREATE TABLE %s.%s (a int PRIMARY KEY, b map<text, text>)"
Expand Down Expand Up @@ -1210,7 +1210,8 @@ 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_version(reason='Column name in CREATE INDEX is not quoted. It\'s a bug in driver or in Scylla',
oss_scylla_version="5.2", ent_scylla_version="2023.1")
def test_case_sensitivity(self):
"""
Test that names that need to be escaped in CREATE statements are
Expand Down
Loading