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

jlewandowski pushed a commit to branch ds-trunk-5.0--2024-07-24
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git

commit a28f01abe8fe03ed2773fd74ce256a0844d6dcbc
Author: Tomek Łasica <tlas...@life.pl>
AuthorDate: Tue Jun 1 13:24:40 2021 +0200

    STAR-432: Add tests for consistency level options (#18)
    
    * STAR-432: Add tests for consistency level options
    
    Co-authored-by: Robert Stupp sn...@snazy.de
    (cherry picked from commit 21c18c599f89427b3f1c865bd577eb15f792d42d)
    (cherry picked from commit e6ae1bf4b11f03d9c2ead7be5088d5408d47ad98)
    (cherry picked from commit 05b7502c6027434a9d3f5f087ef737f59866a2f3)
    (cherry picked from commit b694f0745734562f8ca2721028eb33b734d7397e)
    (cherry picked from commit 5a57ef863ae7369f7362c85afa6f421700808e26)
    (cherry picked from commit f0e5e55539166422aedbc56c4661dadeb3fc99fd)
    (cherry picked from commit ff4f74c886e79c104e608552c4cbf559b2446e25)
    (cherry picked from commit 8c9f07f769690d97073ef0a61033fd68c12cda4f)
---
 cqlsh_tests/test_cqlsh.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/cqlsh_tests/test_cqlsh.py b/cqlsh_tests/test_cqlsh.py
index 2f11504f..92e6b30c 100644
--- a/cqlsh_tests/test_cqlsh.py
+++ b/cqlsh_tests/test_cqlsh.py
@@ -2137,6 +2137,52 @@ 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('4.0')
+    def test_consistency_level_options(self):
+        """
+        Tests for new cmdline consistency options:
+        - consistency-level
+        - serial-consistency-level
+        @jira_ticket STAR-432
+        """
+        self.cluster.populate(1)
+        self.cluster.start()
+
+        node1, = self.cluster.nodelist()
+
+        def expect_output_no_errors(cmd, options, output):
+            stdout, stderr = self.run_cqlsh(node1, cmds=cmd, 
cqlsh_options=options)
+            assert output in stdout, stderr
+            assert stderr == ''
+
+        expect_output_no_errors('CONSISTENCY', [],
+                                'Current consistency level is ONE.')
+
+        expect_output_no_errors('CONSISTENCY', ['--consistency-level', 
'quorum'],
+                                'Current consistency level is QUORUM.')
+
+        expect_output_no_errors('SERIAL CONSISTENCY', [],
+                                'Current serial consistency level is SERIAL.')
+
+        expect_output_no_errors('SERIAL CONSISTENCY', 
['--serial-consistency-level', 'local_serial'],
+                                'Current serial consistency level is 
LOCAL_SERIAL.')
+
+        def expect_error(cmd, options, error_msg):
+            stdout, stderr = self.run_cqlsh(node1, cmds=cmd, 
cqlsh_options=options)
+            assert error_msg in stderr
+
+        expect_error('CONSISTENCY', ['--consistency-level', 'foop'],
+                     '"foop" is not a valid consistency level')
+
+        expect_error('CONSISTENCY', ['--consistency-level', 'serial'],
+                     '"serial" is not a valid consistency level')
+
+        expect_error('SERIAL CONSISTENCY', ['--serial-consistency-level', 
'foop'],
+                     '"foop" is not a valid serial consistency level')
+
+        expect_error('SERIAL CONSISTENCY', ['--serial-consistency-level', 
'ONE'],
+                     '"ONE" is not a valid serial consistency level')
+
     @since('3.0.19')
     def test_protocol_negotiation(self):
         """


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

Reply via email to