mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Better tests
This commit is contained in:
parent
421650dc68
commit
50ae1b3255
@ -2,7 +2,7 @@ import pytest
|
||||
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
cluster = ClickHouseCluster(__file__, name="detach")
|
||||
# Version 21.6.3.14 has incompatible partition id for tables with UUID in partition key.
|
||||
node_21_6 = cluster.add_instance('node_21_6', image='yandex/clickhouse-server', tag='21.6.3.14', stay_alive=True, with_installed_binary=True)
|
||||
|
||||
|
@ -23,27 +23,27 @@ node5 = cluster.add_instance('node5', macros={'cluster': 'test3'}, main_configs=
|
||||
|
||||
all_nodes = [node1, node2, node3, node4, node5]
|
||||
|
||||
def prepare_cluster():
|
||||
for node in all_nodes:
|
||||
node.query("DROP TABLE IF EXISTS test_mutations SYNC")
|
||||
|
||||
for node in [node1, node2, node3, node4]:
|
||||
node.query("""
|
||||
CREATE TABLE test_mutations(d Date, x UInt32, i UInt32)
|
||||
ENGINE ReplicatedMergeTree('/clickhouse/{cluster}/tables/test/test_mutations', '{instance}')
|
||||
ORDER BY x
|
||||
PARTITION BY toYYYYMM(d)
|
||||
SETTINGS number_of_free_entries_in_pool_to_execute_mutation=0
|
||||
""")
|
||||
|
||||
node5.query(
|
||||
"CREATE TABLE test_mutations(d Date, x UInt32, i UInt32) ENGINE MergeTree() ORDER BY x PARTITION BY toYYYYMM(d)")
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def started_cluster():
|
||||
try:
|
||||
cluster.start()
|
||||
|
||||
for node in all_nodes:
|
||||
node.query("DROP TABLE IF EXISTS test_mutations")
|
||||
|
||||
for node in [node1, node2, node3, node4]:
|
||||
node.query("""
|
||||
CREATE TABLE test_mutations(d Date, x UInt32, i UInt32)
|
||||
ENGINE ReplicatedMergeTree('/clickhouse/{cluster}/tables/test/test_mutations', '{instance}')
|
||||
ORDER BY x
|
||||
PARTITION BY toYYYYMM(d)
|
||||
SETTINGS number_of_free_entries_in_pool_to_execute_mutation=0
|
||||
""")
|
||||
|
||||
node5.query(
|
||||
"CREATE TABLE test_mutations(d Date, x UInt32, i UInt32) ENGINE MergeTree() ORDER BY x PARTITION BY toYYYYMM(d)")
|
||||
|
||||
yield cluster
|
||||
|
||||
finally:
|
||||
@ -165,6 +165,8 @@ def wait_for_mutations(nodes, number_of_mutations):
|
||||
|
||||
|
||||
def test_mutations(started_cluster):
|
||||
prepare_cluster()
|
||||
|
||||
DURATION_SECONDS = 30
|
||||
nodes = [node1, node2]
|
||||
|
||||
@ -212,6 +214,8 @@ def test_mutations(started_cluster):
|
||||
]
|
||||
)
|
||||
def test_mutations_dont_prevent_merges(started_cluster, nodes):
|
||||
prepare_cluster()
|
||||
|
||||
for year in range(2000, 2016):
|
||||
rows = ''
|
||||
date_str = '{}-01-{}'.format(year, random.randint(1, 10))
|
||||
|
@ -86,7 +86,7 @@ def test_upgrade_while_mutation(start_cluster):
|
||||
node3.restart_with_latest_version(signal=9)
|
||||
|
||||
# checks for readonly
|
||||
exec_query_with_retry(node3, "OPTIMIZE TABLE mt1", retry_count=60)
|
||||
exec_query_with_retry(node3, "OPTIMIZE TABLE mt1", sleep_time=5, retry_count=60)
|
||||
|
||||
node3.query("ALTER TABLE mt1 DELETE WHERE id > 100000", settings={"mutations_sync": "2"})
|
||||
# will delete nothing, but previous async mutation will finish with this query
|
||||
|
Loading…
Reference in New Issue
Block a user