test: make cql/lwt_* pass with and without tablets

Lightweight transactions don't support tablets, so let's
explicitly disable tablets in LWT tests.
This commit is contained in:
Konstantin Osipov
2024-09-27 09:52:02 -04:00
parent 7c64fc0c4f
commit 92aca17bc5
10 changed files with 93 additions and 6 deletions

View File

@@ -1,3 +1,8 @@
CREATE KEYSPACE ks
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1} AND
tablets = {'enabled': false};
USE ks;
create table lwt (a int, b int, primary key (a,b));
-- basic batch: ok
begin batch
@@ -264,3 +269,7 @@ BEGIN BATCH
UPDATE gh7113 SET int1 = 4, int2 = 8 WHERE part = 0 AND key = 9 IF lwt_trivial = null
UPDATE gh7113 SET int1 = 0, int2 = 9 WHERE part = 0 AND key = 0 IF lwt_trivial = null
APPLY BATCH;
DROP TABLE gh7113;
-- cleanup
DROP KEYSPACE ks;

View File

@@ -1,3 +1,10 @@
> CREATE KEYSPACE ks
> WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1} AND
> tablets = {'enabled': false};
OK
> USE ks;
OK
>
> create table lwt (a int, b int, primary key (a,b));
OK
> -- basic batch: ok
@@ -527,3 +534,9 @@ OK
| True | 0 | 9 | null |
| True | 0 | 0 | null |
+-------------+--------+-------+---------------+
> DROP TABLE gh7113;
OK
>
> -- cleanup
> DROP KEYSPACE ks;
OK

View File

@@ -1,9 +1,14 @@
CREATE KEYSPACE k WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1};
USE k;
CREATE KEYSPACE ks
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1} AND
tablets = {'enabled': false};
USE ks;
CREATE TABLE t1 (userid int PRIMARY KEY);
CREATE TABLE t2 (userid int PRIMARY KEY);
BEGIN BATCH
INSERT INTO t1 (userid) VALUES (1) IF NOT EXISTS
INSERT INTO t2 (userid) VALUES (1) IF NOT EXISTS
APPLY BATCH;
DROP KEYSPACE k;
-- cleanup
DROP KEYSPACE ks;

View File

@@ -1,6 +1,9 @@
> CREATE KEYSPACE k WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1};
> CREATE KEYSPACE ks
> WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1} AND
> tablets = {'enabled': false};
OK
> USE k;
>
> USE ks;
OK
> CREATE TABLE t1 (userid int PRIMARY KEY);
OK
@@ -11,5 +14,7 @@ OK
> INSERT INTO t2 (userid) VALUES (1) IF NOT EXISTS
> APPLY BATCH;
Error from server: code=2200 [Invalid query] message="BATCH with conditions cannot span multiple tables"
> DROP KEYSPACE k;
>
> -- cleanup
> DROP KEYSPACE ks;
OK

View File

@@ -1,3 +1,8 @@
CREATE KEYSPACE ks
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1} AND
tablets = {'enabled': false};
USE ks;
create table t (pk int primary key, c text);
insert into t (pk, c) values (1, 'abc');
insert into t (pk, c) values (2, 'bcd');
@@ -30,3 +35,6 @@ update tm set m = { 2: 'error' } where pk = 1 if m like 'a%';
create table tb (pk int primary key, b blob);
insert into tb (pk, b) values (1, bigintAsBlob(1));
update tb set b = bigintAsBlob(2) where pk = 1 if b like 'a%';
-- cleanup
DROP KEYSPACE ks;

View File

@@ -1,3 +1,10 @@
> CREATE KEYSPACE ks
> WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1} AND
> tablets = {'enabled': false};
OK
> USE ks;
OK
>
> create table t (pk int primary key, c text);
OK
> insert into t (pk, c) values (1, 'abc');
@@ -82,3 +89,7 @@ OK
OK
> update tb set b = bigintAsBlob(2) where pk = 1 if b like 'a%';
Error from server: code=2200 [Invalid query] message="LIKE is allowed only on string types, which b is not"
>
> -- cleanup
> DROP KEYSPACE ks;
OK

View File

@@ -1,3 +1,8 @@
CREATE KEYSPACE ks
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1} AND
tablets = {'enabled': false};
USE ks;
CREATE TABLE t (pk INT PRIMARY KEY, l LIST<INT>);
UPDATE t SET l = [-1] + l WHERE pk = 0;
SELECT l FROM t WHERE pk = 0;
@@ -89,3 +94,6 @@ APPLY BATCH;
SELECT l FROM t WHERE pk = 0;
DROP TABLE t;
-- cleanup
DROP KEYSPACE ks;

View File

@@ -1,3 +1,10 @@
> CREATE KEYSPACE ks
> WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1} AND
> tablets = {'enabled': false};
OK
> USE ks;
OK
>
> CREATE TABLE t (pk INT PRIMARY KEY, l LIST<INT>);
OK
> UPDATE t SET l = [-1] + l WHERE pk = 0;
@@ -214,3 +221,7 @@ Error from server: code=2200 [Invalid query] message="List prepend custom timest
>
> DROP TABLE t;
OK
>
> -- cleanup
> DROP KEYSPACE ks;
OK

View File

@@ -1,3 +1,7 @@
CREATE KEYSPACE ks
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1} AND
tablets = {'enabled': false};
USE ks;
--
-- basic: ensure the grammar works
--
@@ -827,3 +831,6 @@ select count(*) from t;
-- stop this travesty
drop table t;
-- cleanup
DROP KEYSPACE ks;

View File

@@ -1,3 +1,9 @@
> CREATE KEYSPACE ks
> WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1} AND
> tablets = {'enabled': false};
OK
> USE ks;
OK
> --
> -- basic: ensure the grammar works
> --
@@ -2971,3 +2977,7 @@ Error from server: code=2200 [Invalid query] message="DELETE statements must res
> drop table t;
OK
>
> -- cleanup
> DROP KEYSPACE ks;
OK
>