mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Better tests
This commit is contained in:
parent
2430d8192e
commit
abd587cb23
@ -12,6 +12,7 @@ TABLE_NAME = "blob_storage_table"
|
||||
CONTAINER_NAME = "cont"
|
||||
CLUSTER_NAME = "test_cluster"
|
||||
|
||||
drop_table_statement = f"DROP TABLE {TABLE_NAME} ON CLUSTER {CLUSTER_NAME} SYNC"
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def cluster():
|
||||
@ -47,11 +48,9 @@ def create_table(node, table_name, replica, **additional_settings):
|
||||
ORDER BY id
|
||||
SETTINGS {",".join((k+"="+repr(v) for k, v in settings.items()))}"""
|
||||
|
||||
node.query(f"DROP TABLE IF EXISTS {table_name}")
|
||||
node.query(create_table_statement)
|
||||
assert node.query(f"SELECT COUNT(*) FROM {table_name} FORMAT Values") == "(0)"
|
||||
|
||||
|
||||
def get_large_objects_count(blob_container_client, large_size_threshold=100):
|
||||
return sum(blob['size'] > large_size_threshold for blob in blob_container_client.list_blobs())
|
||||
|
||||
@ -81,3 +80,4 @@ def test_zero_copy_replication(cluster):
|
||||
assert node1.query(f"SELECT * FROM {TABLE_NAME} order by id FORMAT Values") == values1 + "," + values2
|
||||
|
||||
assert get_large_objects_count(blob_container_client) == 2
|
||||
node1.query(drop_table_statement)
|
||||
|
@ -60,6 +60,9 @@ def test_backup_from_old_version(started_cluster):
|
||||
|
||||
assert node1.query("CHECK TABLE dest_table") == "1\n"
|
||||
|
||||
node1.query("DROP TABLE source_table")
|
||||
node1.query("DROP TABLE dest_table")
|
||||
|
||||
|
||||
def test_backup_from_old_version_setting(started_cluster):
|
||||
node2.query("CREATE TABLE source_table(A Int64, B String) Engine = MergeTree order by tuple()")
|
||||
@ -97,6 +100,9 @@ def test_backup_from_old_version_setting(started_cluster):
|
||||
|
||||
assert node2.query("CHECK TABLE dest_table") == "1\n"
|
||||
|
||||
node2.query("DROP TABLE source_table")
|
||||
node2.query("DROP TABLE dest_table")
|
||||
|
||||
|
||||
def test_backup_from_old_version_config(started_cluster):
|
||||
node3.query("CREATE TABLE source_table(A Int64, B String) Engine = MergeTree order by tuple()")
|
||||
@ -138,6 +144,8 @@ def test_backup_from_old_version_config(started_cluster):
|
||||
|
||||
assert node3.query("CHECK TABLE dest_table") == "1\n"
|
||||
|
||||
node3.query("DROP TABLE source_table")
|
||||
node3.query("DROP TABLE dest_table")
|
||||
|
||||
def test_backup_and_alter(started_cluster):
|
||||
node4.query("CREATE DATABASE test ENGINE=Ordinary") # Different path in shadow/ with Atomic
|
||||
@ -160,3 +168,6 @@ def test_backup_and_alter(started_cluster):
|
||||
|
||||
assert node4.query("SELECT sum(A) FROM test.backup_table") == "2\n"
|
||||
assert node4.query("SELECT B + 2 FROM test.backup_table") == "4\n"
|
||||
|
||||
node4.query("DROP TABLE test.backup_table")
|
||||
node4.query("DROP DATABASE test")
|
||||
|
Loading…
Reference in New Issue
Block a user