Fix flaky check

This commit is contained in:
MikhailBurdukov 2024-10-16 08:59:11 +00:00
parent 42dd97b78c
commit d1b3f364fb

View File

@ -8,6 +8,7 @@ def fill_nodes(nodes, shard):
for node in nodes:
node.query(
"""
DROP DATABASE IF EXISTS test SYNC;
CREATE DATABASE test;
CREATE TABLE test.test_table(date Date, id UInt32)
@ -20,6 +21,7 @@ def fill_nodes(nodes, shard):
node.query(
"""
DROP DATABASE IF EXISTS test1 SYNC;
CREATE DATABASE test1;
CREATE TABLE test1.test_table(date Date, id UInt32)
@ -32,6 +34,7 @@ def fill_nodes(nodes, shard):
node.query(
"""
DROP DATABASE IF EXISTS test2 SYNC;
CREATE DATABASE test2;
CREATE TABLE test2.test_table(date Date, id UInt32)
@ -44,7 +47,8 @@ def fill_nodes(nodes, shard):
node.query(
"""
CREATE DATABASE test3;
DROP DATABASE IF EXISTS test3 SYNC;
CREATE DATABASE test3;
CREATE TABLE test3.test_table(date Date, id UInt32)
ENGINE = ReplicatedMergeTree('/clickhouse/tables/test3/{shard}/replicated/test_table', '{replica}') ORDER BY id PARTITION BY toYYYYMM(date)
@ -56,6 +60,7 @@ def fill_nodes(nodes, shard):
node.query(
"""
DROP DATABASE IF EXISTS test4 SYNC;
CREATE DATABASE test4;
CREATE TABLE test4.test_table(date Date, id UInt32)
@ -83,9 +88,6 @@ node_1_3 = cluster.add_instance(
def start_cluster():
try:
cluster.start()
fill_nodes([node_1_1, node_1_2], 1)
yield cluster
except Exception as ex:
@ -101,6 +103,8 @@ def check_exists(zk, path):
def test_drop_replica(start_cluster):
fill_nodes([node_1_1, node_1_2], 1)
node_1_1.query(
"INSERT INTO test.test_table SELECT number, toString(number) FROM numbers(100)"
)
@ -230,3 +234,7 @@ def test_drop_replica(start_cluster):
),
)
assert exists_replica_1_2 == None
node_1_1.query("ATTACH DATABASE test")
for i in range(1, 5):
node_1_1.query("ATTACH DATABASE test{}".format(i))