From 5e5e4c53239ebf3db63bad00f4d02cfd5bb31bdf Mon Sep 17 00:00:00 2001 From: Jan Ciolek Date: Thu, 9 Mar 2023 15:37:18 +0100 Subject: [PATCH] cql-pytest/test_lwt: test LWT update with empty partition range Add a test case which performs an LWT UPDATE, but the partition key has 0 possible values, because it's supposed to be equal to two different values. Such queries used to cause problems in the past. Signed-off-by: Jan Ciolek --- test/cql-pytest/test_lwt.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/cql-pytest/test_lwt.py b/test/cql-pytest/test_lwt.py index 058587cff6..61bc1dab3c 100644 --- a/test/cql-pytest/test_lwt.py +++ b/test/cql-pytest/test_lwt.py @@ -62,3 +62,10 @@ def test_lwt_static_condition(cql, table1): # respectively. with pytest.raises(InvalidRequest, match=re.compile('missing', re.IGNORECASE)): cql.execute(f'UPDATE {table1} SET s=2 WHERE p={p} IF r=1') + +# Generate an LWT update where there is no value for the partition key, +# as the WHERE restricts it using `p = {p} AND p = {p+1}`. +# Such quries are rejected. +def test_lwt_empty_partition_range(cql, table1): + with pytest.raises(InvalidRequest): + cql.execute(f"UPDATE {table1} SET r = 9000 WHERE p = 1 AND p = 1000 AND c = 2 IF r = 3")