This is an automated email from the ASF dual-hosted git repository.

samt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git


The following commit(s) were added to refs/heads/master by this push:
     new 9ca95e1  Add cqlsh test for protocol negotiation
9ca95e1 is described below

commit 9ca95e115fda079fa6e5e1f71663484f0328698a
Author: Sam Tunnicliffe <s...@beobal.com>
AuthorDate: Tue Jul 9 16:58:24 2019 +0100

    Add cqlsh test for protocol negotiation
    
    Also, disable automatic protocol version capping for batch_test
    
    Patch by Sam Tunnicliffe; reviewed by Alex Petrov for CASSANDRA-15193
    
    closes #54
---
 batch_test.py             |  2 +-
 cqlsh_tests/test_cqlsh.py | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/batch_test.py b/batch_test.py
index 48b6d87..586d888 100644
--- a/batch_test.py
+++ b/batch_test.py
@@ -505,4 +505,4 @@ class TestBatch(Tester):
         remove_perf_disable_shared_mem(node)
         # Restart nodes on new version
         logger.debug('Starting {} on new version ({})'.format(node.name, 
node.get_cassandra_version()))
-        node.start(wait_other_notice=True, wait_for_binary_proto=True)
+        node.start(wait_other_notice=True, wait_for_binary_proto=True, 
jvm_args=['-Dcassandra.disable_max_protocol_auto_override=true'])
diff --git a/cqlsh_tests/test_cqlsh.py b/cqlsh_tests/test_cqlsh.py
index 5023828..ab905c5 100644
--- a/cqlsh_tests/test_cqlsh.py
+++ b/cqlsh_tests/test_cqlsh.py
@@ -1571,6 +1571,43 @@ Tracing session:""")
         stdout, stderr = self.run_cqlsh(node1, cmds='USE system', 
cqlsh_options=['--debug', '--connect-timeout=10'])
         assert "Using connect timeout: 10 seconds" in stderr
 
+    @since('3.0.19')
+    def test_protocol_negotiation(self):
+        """
+        @jira_ticket CASSANDRA-15193
+        """
+        self.cluster.populate(1)
+        self.cluster.start(wait_for_binary_proto=True)
+
+        node1, = self.cluster.nodelist()
+        stdout, stderr = self.run_cqlsh(node1, cmds='USE system', 
cqlsh_options=['--tty'])
+        assert "Native protocol v4" in stdout
+
+        stdout, stderr = self.run_cqlsh(node1, cmds='USE systeml', 
cqlsh_options=['--protocol-version=3', '--tty'])
+        assert "Native protocol v3" in stdout
+
+    @since('3.0.19')
+    def test_protocol_version_restriction(self):
+        """
+        @jira_ticket CASSANDRA-15193
+        """
+        self.cluster.populate(1)
+        self.cluster.set_configuration_options({ 
'native_transport_max_negotiable_protocol_version': str(3)})
+        self.cluster.start(wait_for_binary_proto=True)
+
+        node1, = self.cluster.nodelist()
+        stdout, stderr = self.run_cqlsh(node1, cmds='USE system', 
cqlsh_options=['--tty'])
+        # yaml property is deprecated from 4.0 and has no effect
+        if node1.get_cassandra_version() < '4.0':
+            assert "Native protocol v3" in stdout
+
+        node1, = self.cluster.nodelist()
+        stdout, stderr = self.run_cqlsh(node1, cmds='USE system', 
cqlsh_options=['--protocol-version=4', '--tty'])
+        # yaml property is deprecated from 4.0 and has no effect
+        if node1.get_cassandra_version() < '4.0':
+            assert "ProtocolError returned from server while using explicitly 
set client protocol_version 4" in stderr
+
+
     def test_update_schema_with_down_node(self):
         """
         Test that issuing a DML statement after a DDL statement will work with 
a down node


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to