-
Notifications
You must be signed in to change notification settings - Fork 44
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
github actions: run integration test on cassandra #339
base: master
Are you sure you want to change the base?
Changes from all commits
29b2021
2560f2f
a835032
1d2894d
78bff7f
7b6eb84
4b47f4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -394,12 +394,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") | ||
|
@@ -629,8 +630,16 @@ def use_cluster(cluster_name, nodes, ipformat=None, start=True, workloads=None, | |
else: | ||
CCM_CLUSTER = CCMCluster(path, cluster_name, **ccm_options) | ||
CCM_CLUSTER.set_configuration_options({'start_native_transport': True}) | ||
if Version(cassandra_version) >= Version('2.2'): | ||
CCM_CLUSTER.set_configuration_options({'enable_user_defined_functions': True}) | ||
if Version(cassandra_version) >= Version('4.1'): | ||
CCM_CLUSTER.set_configuration_options({ | ||
'user_defined_functions_enabled': True, | ||
'scripted_user_defined_functions_enabled': True, | ||
'materialized_views_enabled': True, | ||
'sasi_indexes_enabled': True, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to enable sasi_indexes_enabled ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have a clue, it's just same as the driver test was doing before for configuring cassandra, but in a new syntax. |
||
'transient_replication_enabled': True, | ||
}) | ||
elif Version(cassandra_version) >= Version('2.2'): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we ever test earlier than 2.2 versions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so far we didn't test cassandra at all, for sure we haven't test anything else but |
||
CCM_CLUSTER.set_configuration_options({'user_defined_functions_enabled': True}) | ||
if Version(cassandra_version) >= Version('3.0'): | ||
CCM_CLUSTER.set_configuration_options({'enable_scripted_user_defined_functions': True}) | ||
if Version(cassandra_version) >= Version('4.0-a'): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
from cassandra import InvalidRequest | ||
|
||
import unittest | ||
|
||
import pytest | ||
|
||
from cassandra.protocol import ConfigurationException | ||
from tests.integration import use_singledc, PROTOCOL_VERSION, TestCluster, greaterthanorequalcass40, notdse | ||
|
@@ -101,7 +101,7 @@ def test_get_control_connection_host(self): | |
self.assertNotEqual(host, new_host) | ||
|
||
# TODO: enable after https://github.com/scylladb/python-driver/issues/121 is fixed | ||
@unittest.skip('Fails on scylla due to the broadcast_rpc_port is None') | ||
@pytest.mark.skip('Fails on scylla due to the broadcast_rpc_port is None') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the difference, why did you replace it ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as mentioned in the commit message, unittest.skip doesn't skip the setup/teardown code when using pytest as test runner, hence creating the cluster even for skipped tests. for some of those test it was an issue, since the cassandra couldn't create the cluster. |
||
@notdse | ||
@greaterthanorequalcass40 | ||
def test_control_connection_port_discovery(self): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
|
@@ -42,7 +42,8 @@ | |
greaterthancass21, assert_startswith, greaterthanorequalcass40, | ||
greaterthanorequaldse67, lessthancass40, | ||
TestCluster, DSE_VERSION, requires_java_udf, requires_composite_type, | ||
requires_collection_indexes, SCYLLA_VERSION, xfail_scylla, xfail_scylla_version_lt) | ||
requires_collection_indexes, SCYLLA_VERSION, xfail_scylla, xfail_scylla_version_lt, | ||
scylla_only, EVENT_LOOP_MANAGER) | ||
|
||
from tests.util import wait_until | ||
|
||
|
@@ -55,7 +56,7 @@ def setup_module(): | |
|
||
class HostMetaDataTests(BasicExistingKeyspaceUnitTestCase): | ||
# TODO: enable after https://github.com/scylladb/python-driver/issues/121 is fixed | ||
@unittest.skip('Fails on scylla due to the broadcast_rpc_port is None') | ||
@pytest.mark.skip('Fails on scylla due to the broadcast_rpc_port is None') | ||
@local | ||
def test_host_addresses(self): | ||
""" | ||
|
@@ -214,6 +215,7 @@ def get_table_metadata(self): | |
self.cluster.refresh_table_metadata(self.keyspace_name, self.function_table_name) | ||
return self.cluster.metadata.keyspaces[self.keyspace_name].tables[self.function_table_name] | ||
|
||
@pytest.mark.xfail(reason="test not stable on cassandra", condition=EVENT_LOOP_MANAGER=="asyncio" and SCYLLA_VERSION is None, strict=False) | ||
def test_basic_table_meta_properties(self): | ||
create_statement = self.make_create_statement(["a"], [], ["b", "c"]) | ||
self.session.execute(create_statement) | ||
|
@@ -572,6 +574,7 @@ def test_non_size_tiered_compaction(self): | |
self.assertNotIn("max_threshold", cql) | ||
|
||
@requires_java_udf | ||
@pytest.mark.xfail(reason="test not stable on cassandra", condition=EVENT_LOOP_MANAGER=="asyncio" and SCYLLA_VERSION is None, strict=False) | ||
def test_refresh_schema_metadata(self): | ||
""" | ||
test for synchronously refreshing all cluster metadata | ||
|
@@ -1061,6 +1064,7 @@ def test_metadata_pagination(self): | |
self.cluster.refresh_schema_metadata() | ||
self.assertEqual(len(self.cluster.metadata.keyspaces[self.keyspace_name].tables), 12) | ||
|
||
@pytest.mark.xfail(reason="test not stable on cassandra", condition=EVENT_LOOP_MANAGER=="asyncio" and SCYLLA_VERSION is None, strict=False) | ||
def test_metadata_pagination_keyspaces(self): | ||
""" | ||
test for covering | ||
|
@@ -1279,13 +1283,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') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefere to create an issue and investigate what is going on here, why on scylla driver get's different rack name ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's ccm code scylla default to we can align it on ccm, if you insist |
||
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'), []) | ||
|
@@ -1295,7 +1299,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): | ||
|
@@ -1334,7 +1338,7 @@ def test_token(self): | |
self.assertEqual(expected_node_count, len(tmap.ring)) | ||
cluster.shutdown() | ||
|
||
|
||
@scylla_only # this is scylla only, since the metadata timeout feature doesn't cover peers_v2 queries that is used by cassandra | ||
class MetadataTimeoutTest(unittest.TestCase): | ||
""" | ||
Test of TokenMap creation and other behavior. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,17 @@ | |
from cassandra.cluster import Cluster | ||
from cassandra.policies import ConstantReconnectionPolicy, RackAwareRoundRobinPolicy | ||
|
||
from tests.integration import PROTOCOL_VERSION, get_cluster, use_multidc | ||
from tests.integration import PROTOCOL_VERSION, get_cluster, use_multidc, scylla_only | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
def setup_module(): | ||
use_multidc({'DC1': {'RC1': 2, 'RC2': 2}, 'DC2': {'RC1': 3}}) | ||
|
||
# cassandra is failing in a weird way: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please create an issue of that and link it in a comment |
||
# Token allocation failed: the number of racks 2 in datacenter DC1 is lower than its replication factor 3. | ||
# for now just run it with scylla only | ||
@scylla_only | ||
class RackAwareRoundRobinPolicyTests(unittest.TestCase): | ||
@classmethod | ||
def setup_class(cls): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we have explanation why to run it only on scylla ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RateLimitExceededException is a scylla only feature... it's error only scylla generate, and cassandra doesn't |
||
class TestRateLimitExceededException(unittest.TestCase): | ||
@classmethod | ||
def setup_class(cls): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not 4.1.7 (latest 4.1.x) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cause the the version that was available when I started this effort