Skip to content

Commit 5c8fac6

Browse files
authored
Merge pull request datastax#982 from datastax/python-1018_dse-smoke-tests-and-version-check-logic
PYTHON-1018 dse smoke tests and version check logic
2 parents cea72fe + 55d3e32 commit 5c8fac6

File tree

4 files changed

+43
-19
lines changed

4 files changed

+43
-19
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
3.15.1
2+
======
3+
September 6, 2018
4+
5+
Bug Fixes
6+
---------
7+
* C* 4.0 schema-parsing logic breaks running against DSE 6.0.X (PYTHON-1018)
8+
19
3.15.0
210
======
311
August 30, 2018

cassandra/metadata.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2720,7 +2720,9 @@ def export_as_string(self):
27202720

27212721
def get_schema_parser(connection, server_version, timeout):
27222722
server_major_version = int(server_version.split('.')[0])
2723-
if server_major_version >= 4:
2723+
# check for DSE version
2724+
has_build_version = len(server_version.split('.')) > 3
2725+
if server_major_version >= 4 and not has_build_version:
27242726
return SchemaParserV4(connection, timeout)
27252727
if server_major_version >= 3:
27262728
return SchemaParserV3(connection, timeout)

tests/integration/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,14 @@ def is_current_cluster(cluster_name, node_counts):
351351

352352

353353
def use_cluster(cluster_name, nodes, ipformat=None, start=True, workloads=[], set_keyspace=True, ccm_options=None,
354-
configuration_options={}, dse_cluster=False, dse_options={}):
354+
configuration_options={}, dse_cluster=False, dse_options={},
355+
dse_version=None):
356+
if (dse_version and not dse_cluster):
357+
raise ValueError('specified dse_version {} but not dse_cluster'.format(dse_version))
355358
set_default_cass_ip()
356359

357360
if ccm_options is None and dse_cluster:
358-
ccm_options = {"version": DSE_VERSION}
361+
ccm_options = {"version": dse_version or DSE_VERSION}
359362
elif ccm_options is None:
360363
ccm_options = CCM_KWARGS.copy()
361364

tests/integration/standard/test_dse.py

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,22 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
try:
16-
import unittest2 as unittest
17-
except ImportError:
18-
import unittest # noqa
15+
import os
1916

17+
from packaging.version import Version
2018

2119
from cassandra.cluster import Cluster
22-
from tests import notwindows, is_windows
23-
from tests.integration import use_cluster, CLUSTER_NAME, PROTOCOL_VERSION, execute_until_pass, \
24-
execute_with_long_wait_retry
25-
20+
from tests import notwindows
21+
from tests.integration import (execute_until_pass,
22+
execute_with_long_wait_retry, use_cluster)
2623

27-
def setup_module():
28-
if is_windows():
29-
return
30-
use_cluster(CLUSTER_NAME, [3], dse_cluster=True, dse_options={})
24+
try:
25+
import unittest2 as unittest
26+
except ImportError:
27+
import unittest # noqa
3128

3229

30+
@unittest.skipIf(os.environ.get('CCM_ARGS', None), 'environment has custom CCM_ARGS; skipping')
3331
@notwindows
3432
class DseCCMClusterTest(unittest.TestCase):
3533
"""
@@ -38,21 +36,34 @@ class DseCCMClusterTest(unittest.TestCase):
3836
If CASSANDRA_VERSION is set instead, it will be converted to the corresponding DSE_VERSION
3937
"""
4038

41-
def test_basic(self):
39+
def test_dse_5x(self):
40+
self._test_basic(Version('5.1.10'))
41+
42+
def test_dse_60(self):
43+
self._test_basic(Version('6.0.2'))
44+
45+
def _test_basic(self, dse_version):
4246
"""
4347
Test basic connection and usage
4448
"""
49+
cluster_name = '{}-{}'.format(
50+
self.__class__.__name__, dse_version.base_version.replace('.', '_')
51+
)
52+
use_cluster(cluster_name=cluster_name, nodes=[3],
53+
dse_cluster=True, dse_options={}, dse_version=dse_version)
4554

46-
cluster = Cluster(protocol_version=PROTOCOL_VERSION)
55+
cluster = Cluster()
4756
session = cluster.connect()
48-
result = execute_until_pass(session,
57+
result = execute_until_pass(
58+
session,
4959
"""
5060
CREATE KEYSPACE clustertests
5161
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}
5262
""")
5363
self.assertFalse(result)
5464

55-
result = execute_with_long_wait_retry(session,
65+
result = execute_with_long_wait_retry(
66+
session,
5667
"""
5768
CREATE TABLE clustertests.cf0 (
5869
a text,

0 commit comments

Comments
 (0)