@@ -1861,6 +1861,52 @@ def test_connect_timeout(self):
1861
1861
stdout , stderr = self .run_cqlsh (node1 , cmds = 'USE system' , cqlsh_options = ['--debug' , '--connect-timeout=10' ])
1862
1862
assert "Using connect timeout: 10 seconds" in stderr
1863
1863
1864
+ @since ('4.0' )
1865
+ def test_consistency_level_options (self ):
1866
+ """
1867
+ Tests for new cmdline consistency options:
1868
+ - consistency-level
1869
+ - serial-consistency-level
1870
+ @jira_ticket STAR-432
1871
+ """
1872
+ self .cluster .populate (1 )
1873
+ self .cluster .start ()
1874
+
1875
+ node1 , = self .cluster .nodelist ()
1876
+
1877
+ def expect_output_no_errors (cmd , options , output ):
1878
+ stdout , stderr = self .run_cqlsh (node1 , cmds = cmd , cqlsh_options = options )
1879
+ assert output in stdout , stderr
1880
+ assert stderr == ''
1881
+
1882
+ expect_output_no_errors ('CONSISTENCY' , [],
1883
+ 'Current consistency level is ONE.' )
1884
+
1885
+ expect_output_no_errors ('CONSISTENCY' , ['--consistency-level' , 'quorum' ],
1886
+ 'Current consistency level is QUORUM.' )
1887
+
1888
+ expect_output_no_errors ('SERIAL CONSISTENCY' , [],
1889
+ 'Current serial consistency level is SERIAL.' )
1890
+
1891
+ expect_output_no_errors ('SERIAL CONSISTENCY' , ['--serial-consistency-level' , 'local_serial' ],
1892
+ 'Current serial consistency level is LOCAL_SERIAL.' )
1893
+
1894
+ def expect_error (cmd , options , error_msg ):
1895
+ stdout , stderr = self .run_cqlsh (node1 , cmds = cmd , cqlsh_options = options )
1896
+ assert error_msg in stderr
1897
+
1898
+ expect_error ('CONSISTENCY' , ['--consistency-level' , 'foop' ],
1899
+ '"foop" is not a valid consistency level' )
1900
+
1901
+ expect_error ('CONSISTENCY' , ['--consistency-level' , 'serial' ],
1902
+ '"serial" is not a valid consistency level' )
1903
+
1904
+ expect_error ('SERIAL CONSISTENCY' , ['--serial-consistency-level' , 'foop' ],
1905
+ '"foop" is not a valid serial consistency level' )
1906
+
1907
+ expect_error ('SERIAL CONSISTENCY' , ['--serial-consistency-level' , 'ONE' ],
1908
+ '"ONE" is not a valid serial consistency level' )
1909
+
1864
1910
@since ('3.0.19' )
1865
1911
def test_protocol_negotiation (self ):
1866
1912
"""
0 commit comments