Skip to content

Commit fdfcdf5

Browse files
committed
Support running integration tests with scylla-ccm
1 parent a1f8e10 commit fdfcdf5

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

tests/integration/__init__.py

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
try:
4545
from ccmlib.dse_cluster import DseCluster
4646
from ccmlib.cluster import Cluster as CCMCluster
47+
from ccmlib.scylla_cluster import ScyllaCluster as CCMSCyllaCluster
4748
from ccmlib.cluster_factory import ClusterFactory as CCMClusterFactory
4849
from ccmlib import common
4950
except ImportError as e:
@@ -174,8 +175,12 @@ def _get_dse_version_from_cass(cass_version):
174175
try:
175176
cassandra_version = Version(cv_string) # env var is set to test-dse for DDAC
176177
except:
177-
# fallback to MAPPED_CASSANDRA_VERSION
178-
cassandra_version = Version(mcv_string)
178+
try:
179+
# fallback to MAPPED_CASSANDRA_VERSION
180+
cassandra_version = Version(mcv_string)
181+
except:
182+
cassandra_version = Version('3.11.4')
183+
cv_string = '3.11.4'
179184

180185
CASSANDRA_VERSION = Version(mcv_string) if mcv_string else cassandra_version
181186
CCM_VERSION = mcv_string if mcv_string else cv_string
@@ -184,20 +189,27 @@ def _get_dse_version_from_cass(cass_version):
184189
CASSANDRA_DIR = os.getenv('CASSANDRA_DIR', None)
185190

186191
CCM_KWARGS = {}
192+
IS_SCYLLA = False
187193
if DSE_VERSION:
188194
log.info('Using DSE version: %s', DSE_VERSION)
189195
if not CASSANDRA_DIR:
190196
CCM_KWARGS['version'] = DSE_VERSION
191197
if DSE_CRED:
192198
log.info("Using DSE credentials file located at {0}".format(DSE_CRED))
193199
CCM_KWARGS['dse_credentials_file'] = DSE_CRED
200+
194201
elif CASSANDRA_DIR:
195202
log.info("Using Cassandra dir: %s", CASSANDRA_DIR)
196203
CCM_KWARGS['install_dir'] = CASSANDRA_DIR
197-
else:
204+
elif os.environ.get('CASSANDRA_VERSION'):
198205
log.info('Using Cassandra version: %s', CCM_VERSION)
199206
CCM_KWARGS['version'] = CCM_VERSION
200-
207+
elif os.getenv('INSTALL_DIRECTORY'):
208+
CCM_KWARGS['install_dir'] = os.path.join(os.getenv('INSTALL_DIRECTORY'))
209+
IS_SCYLLA = True
210+
elif os.getenv('SCYLLA_VERSION'):
211+
CCM_KWARGS['cassandra_version'] = os.path.join(os.getenv('SCYLLA_VERSION'))
212+
IS_SCYLLA = True
201213

202214
#This changes the default contact_point parameter in Cluster
203215
def set_default_cass_ip():
@@ -447,10 +459,10 @@ def is_current_cluster(cluster_name, node_counts, workloads):
447459
if CCM_CLUSTER and CCM_CLUSTER.name == cluster_name:
448460
if [len(list(nodes)) for dc, nodes in
449461
groupby(CCM_CLUSTER.nodelist(), lambda n: n.data_center)] == node_counts:
450-
for node in CCM_CLUSTER.nodelist():
451-
if set(node.workloads) != set(workloads):
452-
print("node workloads don't match creating new cluster")
453-
return False
462+
#for node in CCM_CLUSTER.nodelist():
463+
# if set(node.workloads) != set(workloads):
464+
# print("node workloads don't match creating new cluster")
465+
# return False
454466
return True
455467
return False
456468

@@ -559,8 +571,14 @@ def use_cluster(cluster_name, nodes, ipformat=None, start=True, workloads=None,
559571

560572
CCM_CLUSTER.set_dse_configuration_options(dse_options)
561573
else:
562-
CCM_CLUSTER = CCMCluster(path, cluster_name, **ccm_options)
574+
if IS_SCYLLA:
575+
CCM_CLUSTER = CCMSCyllaCluster(path, cluster_name, **ccm_options)
576+
else:
577+
CCM_CLUSTER = CCMCluster(path, cluster_name, **ccm_options)
563578
CCM_CLUSTER.set_configuration_options({'start_native_transport': True})
579+
if IS_SCYLLA:
580+
CCM_CLUSTER.set_configuration_options({'experimental': True})
581+
564582
if Version(cassandra_version) >= Version('2.2'):
565583
CCM_CLUSTER.set_configuration_options({'enable_user_defined_functions': True})
566584
if Version(cassandra_version) >= Version('3.0'):
@@ -574,9 +592,9 @@ def use_cluster(cluster_name, nodes, ipformat=None, start=True, workloads=None,
574592

575593
# This will enable the Mirroring query handler which will echo our custom payload k,v pairs back
576594

577-
if 'graph' not in workloads:
578-
if PROTOCOL_VERSION >= 4:
579-
jvm_args = [" -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"]
595+
#if 'graph' not in workloads:
596+
# if PROTOCOL_VERSION >= 4:
597+
# jvm_args = [" -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"]
580598
if len(workloads) > 0:
581599
for node in CCM_CLUSTER.nodes.values():
582600
node.set_workloads(workloads)

0 commit comments

Comments
 (0)