From ab99789ef107b99bdee3c6ffc6e1def97eeee8c3 Mon Sep 17 00:00:00 2001 From: Benjamin Lerer Date: Thu, 21 Mar 2024 17:19:58 +0100 Subject: [PATCH 1/3] Remove error test already covered by unit tests --- json_test.py | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/json_test.py b/json_test.py index 4f2e32b5dd..685672819a 100644 --- a/json_test.py +++ b/json_test.py @@ -1238,38 +1238,6 @@ def test_simple_schema(self): """ run_func_docstring(tester=self, test_func=self.test_simple_schema) - def test_pkey_requirement(self): - """ - Create schema: - - >>> cqlsh(''' - ... CREATE TABLE primitive_type_test ( - ... key1 text PRIMARY KEY, - ... col1 ascii, - ... col2 blob, - ... col3 inet, - ... col4 text, - ... col5 timestamp, - ... col6 timeuuid, - ... col7 uuid, - ... col8 varchar, - ... col9 bigint, - ... col10 decimal, - ... col11 double, - ... col12 float, - ... col13 int, - ... col14 varint, - ... col15 boolean) - ... ''') - - Try to create a JSON row with the pkey omitted from the column list, and omitted from the JSON data: - - >>> cqlsh_err_print('''INSERT INTO primitive_type_test JSON '{"col1": "bar"}' ''') - :2:InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid null value in condition for column key1" - - """ - run_func_docstring(tester=self, test_func=self.test_pkey_requirement) - def test_null_value(self): """ Create schema: From bed543143fbf0bc9cefc6d26e90ff03ecae0ebc3 Mon Sep 17 00:00:00 2001 From: Benjamin Lerer Date: Fri, 26 Apr 2024 15:37:34 +0200 Subject: [PATCH 2/3] Remove slow tests assuming a given ordering for the restrictions --- cql_test.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cql_test.py b/cql_test.py index 99d3088ced..115d21f78e 100644 --- a/cql_test.py +++ b/cql_test.py @@ -1219,12 +1219,6 @@ def _assert_logs_slow_queries_with_skinny_table(node, session): TestCQLSlowQuery._assert_logs(node, session, table, query="SELECT * FROM {} WHERE k >= 0 AND k < 100 ALLOW FILTERING", logged_query="SELECT \* FROM ks.{} WHERE k >= 0 AND k < 100") - TestCQLSlowQuery._assert_logs(node, session, table, - query="SELECT * FROM {} WHERE k <= 100 AND k > 0 ALLOW FILTERING", - logged_query="SELECT \* FROM ks.{} WHERE k > 0 AND k <= 100") - TestCQLSlowQuery._assert_logs(node, session, table, - query="SELECT * FROM {} WHERE k < 100 AND k >= 0 ALLOW FILTERING", - logged_query="SELECT \* FROM ks.{} WHERE k >= 0 AND k < 100") # test logging of slow queries with restriciton on regular column TestCQLSlowQuery._assert_logs(node, session, table, From 36faf7b02908722bf5abc57a98eeb18c2ba5f65b Mon Sep 17 00:00:00 2001 From: Benjamin Lerer Date: Tue, 30 Apr 2024 12:08:07 +0200 Subject: [PATCH 3/3] Review comments --- cql_test.py | 17 ++++++++++++++++- json_test.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/cql_test.py b/cql_test.py index 115d21f78e..30c5507d02 100644 --- a/cql_test.py +++ b/cql_test.py @@ -1220,7 +1220,22 @@ def _assert_logs_slow_queries_with_skinny_table(node, session): query="SELECT * FROM {} WHERE k >= 0 AND k < 100 ALLOW FILTERING", logged_query="SELECT \* FROM ks.{} WHERE k >= 0 AND k < 100") - # test logging of slow queries with restriciton on regular column + if node.cluster.version() >= '5.1': + TestCQLSlowQuery._assert_logs(node, session, table, + query="SELECT * FROM {} WHERE k <= 100 AND k > 0 ALLOW FILTERING", + logged_query="SELECT \* FROM ks.{} WHERE k <= 100 AND k > 0") + TestCQLSlowQuery._assert_logs(node, session, table, + query="SELECT * FROM {} WHERE k < 100 AND k >= 0 ALLOW FILTERING", + logged_query="SELECT \* FROM ks.{} WHERE k < 100 AND k >= 0") + else: + TestCQLSlowQuery._assert_logs(node, session, table, + query="SELECT * FROM {} WHERE k <= 100 AND k > 0 ALLOW FILTERING", + logged_query="SELECT \* FROM ks.{} WHERE k > 0 AND k <= 100") + TestCQLSlowQuery._assert_logs(node, session, table, + query="SELECT * FROM {} WHERE k < 100 AND k >= 0 ALLOW FILTERING", + logged_query="SELECT \* FROM ks.{} WHERE k >= 0 AND k < 100") + + # test logging of slow queries with restriction on regular column TestCQLSlowQuery._assert_logs(node, session, table, query="SELECT * FROM {} WHERE v = 1 ALLOW FILTERING", logged_query="SELECT \* FROM ks.{} WHERE v = 1") diff --git a/json_test.py b/json_test.py index 685672819a..94c09f55c1 100644 --- a/json_test.py +++ b/json_test.py @@ -1238,6 +1238,36 @@ def test_simple_schema(self): """ run_func_docstring(tester=self, test_func=self.test_simple_schema) + @since("2.0", max_version="5.0") + def test_pkey_requirement(self): + """ + Create schema: + >>> cqlsh(''' + ... CREATE TABLE primitive_type_test ( + ... key1 text PRIMARY KEY, + ... col1 ascii, + ... col2 blob, + ... col3 inet, + ... col4 text, + ... col5 timestamp, + ... col6 timeuuid, + ... col7 uuid, + ... col8 varchar, + ... col9 bigint, + ... col10 decimal, + ... col11 double, + ... col12 float, + ... col13 int, + ... col14 varint, + ... col15 boolean) + ... ''') + Try to create a JSON row with the pkey omitted from the column list, and omitted from the JSON data: + >>> cqlsh_err_print('''INSERT INTO primitive_type_test JSON '{"col1": "bar"}' ''') + :2:InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid null value in condition for column key1" + + """ + run_func_docstring(tester=self, test_func=self.test_pkey_requirement) + def test_null_value(self): """ Create schema: