Merge pull request #23903 from azat/fix-flaky-tests-21.6

Fix test_insert_into_distributed flaps
This commit is contained in:
Maksim Kita 2021-05-10 00:44:46 +03:00 committed by GitHub
commit 742434a0cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -198,28 +198,34 @@ def test_inserts_single_replica_local_internal_replication(started_cluster):
def test_inserts_single_replica_internal_replication(started_cluster):
node1.query(
"INSERT INTO distributed_one_replica_internal_replication VALUES ('2000-01-01', 1)",
settings={
"insert_distributed_sync": "1",
"prefer_localhost_replica": "0",
# to make the test more deterministic
"load_balancing": "first_or_random",
},
)
assert node2.query("SELECT count(*) FROM single_replicated").strip() == '1'
def test_inserts_single_replica_no_internal_replication(started_cluster):
with pytest.raises(QueryRuntimeException, match="Table default.single_replicated doesn't exist"):
try:
node1.query(
"INSERT INTO distributed_one_replica_no_internal_replication VALUES ('2000-01-01', 1)",
"INSERT INTO distributed_one_replica_internal_replication VALUES ('2000-01-01', 1)",
settings={
"insert_distributed_sync": "1",
"prefer_localhost_replica": "0",
# to make the test more deterministic
"load_balancing": "first_or_random",
},
)
assert node2.query("SELECT count(*) FROM single_replicated").strip() == '1'
assert node2.query("SELECT count(*) FROM single_replicated").strip() == '1'
finally:
node2.query("TRUNCATE TABLE single_replicated")
def test_inserts_single_replica_no_internal_replication(started_cluster):
try:
with pytest.raises(QueryRuntimeException, match="Table default.single_replicated doesn't exist"):
node1.query(
"INSERT INTO distributed_one_replica_no_internal_replication VALUES ('2000-01-01', 1)",
settings={
"insert_distributed_sync": "1",
"prefer_localhost_replica": "0",
},
)
assert node2.query("SELECT count(*) FROM single_replicated").strip() == '1'
finally:
node2.query("TRUNCATE TABLE single_replicated")
def test_prefer_localhost_replica(started_cluster):