Update dtests following CASSANDRA-14973 (#127)
* Specify v5 for pushed notification test if available
* Add v5 to cqlsh protocol negotiation test
* Default to v5 for 4.0
Patch by Sam Tunnicliffe; reviewed by Brandon Williams for CASSANDRA-14973
diff --git a/cqlsh_tests/test_cqlsh.py b/cqlsh_tests/test_cqlsh.py
index 39a1a2b..fa1edad 100644
--- a/cqlsh_tests/test_cqlsh.py
+++ b/cqlsh_tests/test_cqlsh.py
@@ -1864,9 +1864,15 @@
node1, = self.cluster.nodelist()
stdout, stderr = self.run_cqlsh(node1, cmds='USE system', cqlsh_options=['--tty'])
+ if node1.get_cassandra_version() < '4.0':
+ assert "Native protocol v4" in stdout
+ else:
+ assert "Native protocol v5" in stdout
+
+ stdout, stderr = self.run_cqlsh(node1, cmds='USE system', cqlsh_options=['--protocol-version=4', '--tty'])
assert "Native protocol v4" in stdout
- stdout, stderr = self.run_cqlsh(node1, cmds='USE systeml', cqlsh_options=['--protocol-version=3', '--tty'])
+ stdout, stderr = self.run_cqlsh(node1, cmds='USE system', cqlsh_options=['--protocol-version=3', '--tty'])
assert "Native protocol v3" in stdout
@since('3.0.19')
diff --git a/dtest.py b/dtest.py
index 9747c11..f2c89b2 100644
--- a/dtest.py
+++ b/dtest.py
@@ -276,7 +276,9 @@
Returns the highest protocol version accepted
by the given C* version
"""
- if LooseVersion('3.0') <= cassandra_version:
+ if LooseVersion('4.0') <= cassandra_version:
+ protocol_version = 5
+ elif LooseVersion('3.0') <= cassandra_version:
protocol_version = 4
elif LooseVersion('2.1') <= cassandra_version:
protocol_version = 3
diff --git a/pushed_notifications_test.py b/pushed_notifications_test.py
index 137f4d6..6ab311e 100644
--- a/pushed_notifications_test.py
+++ b/pushed_notifications_test.py
@@ -35,7 +35,8 @@
self.keyspace = keyspace
# get a single, new connection
- session = tester.patient_exclusive_cql_connection(node)
+ version = 5 if node.get_cassandra_version() >= LooseVersion('4.0') else None
+ session = tester.patient_exclusive_cql_connection(node, protocol_version=version)
connection = session.cluster.connection_factory(self.address, is_control_connection=True)
# coordinate with an Event
@@ -53,7 +54,6 @@
Called when a notification is pushed from Cassandra.
"""
logger.debug("Got {} from {} at {}".format(notification, self.address, datetime.now()))
-
if self.keyspace and notification['keyspace'] and self.keyspace != notification['keyspace']:
return # we are not interested in this schema change