tests: Adjusted tests for DC checking in NTS

CQL test relied on quietly acceptiong non-existing DCs, so it had
to be removed. Also, one boost-test referred to nonexisting
`datacenter2` and had to be removed.

(cherry picked from commit 97bb15b2f2)
This commit is contained in:
Juliusz Stasiewicz
2021-02-09 07:53:30 +01:00
committed by Nadav Har'El
parent a7a1e59594
commit d214d91a09
3 changed files with 11 additions and 104 deletions

View File

@@ -3634,19 +3634,9 @@ SEASTAR_TEST_CASE(test_rf_expand) {
{"datacenter1", "3"}
});
e.execute_cql("CREATE KEYSPACE rf_expand_3 WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3}").get();
assert_replication_contains("rf_expand_3", {
{"class", simple},
{"replication_factor", "3"}
});
// Should not auto-expand when switching to NetworkTopologyStrategy with additional options.
e.execute_cql("ALTER KEYSPACE rf_expand_3 WITH replication = {'class': 'NetworkTopologyStrategy', 'datacenter2': 2}").get();
assert_replication_not_contains("rf_expand_3", {"datacenter1"});
// Respect factors specified manually.
e.execute_cql("CREATE KEYSPACE rf_expand_4 WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 3, 'datacenter1': 2}").get();
assert_replication_contains("rf_expand_4", {
e.execute_cql("CREATE KEYSPACE rf_expand_3 WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 3, 'datacenter1': 2}").get();
assert_replication_contains("rf_expand_3", {
{"class", network_topology},
{"datacenter1", "2"}
});

View File

@@ -1,25 +1,9 @@
--
-- https://github.com/scylladb/scylla/issues/5935
-- crash if all_replicas is empty test we work well when the list of
-- natural endpoints is empty
-- https://github.com/scylladb/scylla/issues/7595
-- Fail on wrong DC name
--
CREATE KEYSPACE t WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'nosuchdc' : 3 } AND DURABLE_WRITES = true;
CREATE TABLE t.t (a INT PRIMARY KEY, b int);
INSERT INTO t.t (a, b) VALUES (1, 1);
INSERT INTO t.t (a, b) VALUES (2, 2);
SELECT * FROM t.t ALLOW FILTERING;
-- This statement used to trigger a crash
SELECT a FROM t.t WHERE a IN (1, 2);
DELETE FROM t.t WHERE a = 1;
DELETE FROM t.t WHERE a = 2;
CREATE INDEX b ON t.t (b);
SELECT * FROM t.t WHERE b=2;
INSERT INTO t.t (a) VALUES (1) IF NOT EXISTS;
DELETE FROM t.t WHERE a=1 IF EXISTS;
CREATE MATERIALIZED VIEW t.mv AS SELECT a, b FROM t.t WHERE b > 1 PRIMARY KEY (b, a);
SELECT * FROM t.mv WHERE b IN (2, 1);
DROP MATERIALIZED VIEW t.mv;
DROP TABLE t.t;
CREATE KEYSPACE t WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'nosuchdc' : 3 } AND DURABLE_WRITES = true;
CREATE KEYSPACE t WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 3 } AND DURABLE_WRITES = true;
DROP KEYSPACE t;
--
-- https://github.com/scylladb/scylla/issues/5962

View File

@@ -1,80 +1,13 @@
--
-- https://github.com/scylladb/scylla/issues/5935
-- crash if all_replicas is empty test we work well when the list of
-- natural endpoints is empty
-- https://github.com/scylladb/scylla/issues/7595
-- Fail on wrong DC name
--
CREATE KEYSPACE t WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'nosuchdc' : 3 } AND DURABLE_WRITES = true;
CREATE KEYSPACE t WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'nosuchdc' : 3 } AND DURABLE_WRITES = true;
{
"status" : "ok"
}
CREATE TABLE t.t (a INT PRIMARY KEY, b int);
{
"status" : "ok"
}
INSERT INTO t.t (a, b) VALUES (1, 1);
{
"message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
"message" : "exceptions::configuration_exception (Unrecognized strategy option {nosuchdc} passed to org.apache.cassandra.locator.NetworkTopologyStrategy for keyspace t)",
"status" : "error"
}
INSERT INTO t.t (a, b) VALUES (2, 2);
{
"message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
"status" : "error"
}
SELECT * FROM t.t ALLOW FILTERING;
{
"message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
"status" : "error"
}
-- This statement used to trigger a crash
SELECT a FROM t.t WHERE a IN (1, 2);
{
"message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
"status" : "error"
}
DELETE FROM t.t WHERE a = 1;
{
"message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
"status" : "error"
}
DELETE FROM t.t WHERE a = 2;
{
"message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
"status" : "error"
}
CREATE INDEX b ON t.t (b);
{
"status" : "ok"
}
SELECT * FROM t.t WHERE b=2;
{
"message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
"status" : "error"
}
INSERT INTO t.t (a) VALUES (1) IF NOT EXISTS;
{
"message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl SERIAL. Requires 1, alive 0)",
"status" : "error"
}
DELETE FROM t.t WHERE a=1 IF EXISTS;
{
"message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl SERIAL. Requires 1, alive 0)",
"status" : "error"
}
CREATE MATERIALIZED VIEW t.mv AS SELECT a, b FROM t.t WHERE b > 1 PRIMARY KEY (b, a);
{
"status" : "ok"
}
SELECT * FROM t.mv WHERE b IN (2, 1);
{
"message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
"status" : "error"
}
DROP MATERIALIZED VIEW t.mv;
{
"status" : "ok"
}
DROP TABLE t.t;
CREATE KEYSPACE t WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 3 } AND DURABLE_WRITES = true;
{
"status" : "ok"
}