more tests

This commit is contained in:
Yatsishin Ilya 2024-08-15 08:58:36 +00:00
parent 7a4bd49c42
commit c48b6d25f7
4 changed files with 18 additions and 11 deletions

View File

@ -79,3 +79,7 @@ def test_file_path_escaping(started_cluster):
"test -f /var/lib/clickhouse/shadow/2/store/123/12345678-1000-4000-8000-000000000001/1_1_1_0/%7EId.bin",
]
)
node.query("DROP TABLE test.`T.a_b,l-e!` SYNC")
node.query("DROP TABLE `test 2`.`T.a_b,l-e!` SYNC")
node.query("DROP DATABASE test")
node.query("DROP DATABASE `test 2`")

View File

@ -359,6 +359,8 @@ def test_implicit_create_view_grant():
instance.query("GRANT CREATE VIEW ON test.* TO B", user="A")
instance.query("CREATE VIEW test.view_2 AS SELECT 1", user="B")
assert instance.query("SELECT * FROM test.view_2") == "1\n"
instance.query("DROP USER A")
instance.query("DROP VIEW test.view_2")
def test_implicit_create_temporary_table_grant():

View File

@ -1,5 +1,5 @@
import pytest
import uuid
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
@ -25,19 +25,15 @@ def start_cluster():
def create_tables(cluster, table_name, skip_last_replica):
node1.query(f"DROP TABLE IF EXISTS {table_name} SYNC")
node2.query(f"DROP TABLE IF EXISTS {table_name} SYNC")
node3.query(f"DROP TABLE IF EXISTS {table_name} SYNC")
node1.query(
f"CREATE TABLE IF NOT EXISTS {table_name} (key Int64, value String) Engine=ReplicatedMergeTree('/test_parallel_replicas/shard1/{table_name}', 'r1') ORDER BY (key)"
f"CREATE TABLE {table_name} (key Int64, value String) Engine=ReplicatedMergeTree('/test_parallel_replicas/shard1/{table_name}', 'r1') ORDER BY (key)"
)
node2.query(
f"CREATE TABLE IF NOT EXISTS {table_name} (key Int64, value String) Engine=ReplicatedMergeTree('/test_parallel_replicas/shard1/{table_name}', 'r2') ORDER BY (key)"
f"CREATE TABLE {table_name} (key Int64, value String) Engine=ReplicatedMergeTree('/test_parallel_replicas/shard1/{table_name}', 'r2') ORDER BY (key)"
)
if not skip_last_replica:
node3.query(
f"CREATE TABLE IF NOT EXISTS {table_name} (key Int64, value String) Engine=ReplicatedMergeTree('/test_parallel_replicas/shard1/{table_name}', 'r3') ORDER BY (key)"
f"CREATE TABLE {table_name} (key Int64, value String) Engine=ReplicatedMergeTree('/test_parallel_replicas/shard1/{table_name}', 'r3') ORDER BY (key)"
)
# populate data
@ -67,7 +63,7 @@ def test_skip_replicas_without_table(start_cluster):
for i in range(4):
expected_result += f"{i}\t1000\n"
log_comment = "5230b069-9574-407d-9b80-891b5a175f41"
log_comment = uuid.uuid4()
assert (
node1.query(
f"SELECT key, count() FROM {table_name} GROUP BY key ORDER BY key",
@ -88,6 +84,8 @@ def test_skip_replicas_without_table(start_cluster):
)
== "1\t1\n"
)
node1.query(f"DROP TABLE {table_name} SYNC")
node2.query(f"DROP TABLE {table_name} SYNC")
def test_skip_unresponsive_replicas(start_cluster):
@ -112,3 +110,6 @@ def test_skip_unresponsive_replicas(start_cluster):
)
== expected_result
)
node1.query(f"DROP TABLE {table_name} SYNC")
node2.query(f"DROP TABLE {table_name} SYNC")
node3.query(f"DROP TABLE {table_name} SYNC")

View File

@ -35,11 +35,10 @@ def start_cluster():
def _create_tables(table_name, table_size, index_granularity):
nodes[0].query(f"DROP TABLE IF EXISTS {table_name} ON CLUSTER {cluster_name}")
nodes[0].query(
f"""
CREATE TABLE IF NOT EXISTS {table_name} ON CLUSTER '{cluster_name}' (key Int64, value String)
CREATE TABLE {table_name} ON CLUSTER '{cluster_name}' (key Int64, value String)
Engine=ReplicatedMergeTree('/test_parallel_replicas/shard/{table_name}/', '{{replica}}')
ORDER BY (key)
SETTINGS index_granularity = {index_granularity}, max_bytes_to_merge_at_max_space_in_pool = 0, max_bytes_to_merge_at_max_space_in_pool = 1
@ -128,3 +127,4 @@ def test_reading_with_invisible_parts(
)
== f"{expected}\n"
)
nodes[0].query(f"DROP TABLE {table_name} ON CLUSTER {cluster_name} SYNC")