mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 21:42:39 +00:00
2a18ada890
part_log must be created in system database, because otherwise it is not guaranteed that part_log loaded before it can be used by other table
43 lines
2.1 KiB
Python
43 lines
2.1 KiB
Python
import time
|
|
import pytest
|
|
|
|
from helpers.cluster import ClickHouseCluster
|
|
|
|
cluster = ClickHouseCluster(__file__)
|
|
node1 = cluster.add_instance("node1")
|
|
node2 = cluster.add_instance("node2", main_configs=["configs/config_with_standard_part_log.xml"])
|
|
node3 = cluster.add_instance("node3", main_configs=["configs/config_with_non_standard_part_log.xml"])
|
|
|
|
@pytest.fixture(scope="module")
|
|
def start_cluster():
|
|
try:
|
|
cluster.start()
|
|
yield cluster
|
|
finally:
|
|
cluster.shutdown()
|
|
|
|
def test_config_without_part_log(start_cluster):
|
|
assert "Table system.part_log doesn't exist" in node1.query_and_get_error("SELECT * FROM system.part_log")
|
|
node1.query("CREATE TABLE test_table(word String, value UInt64) ENGINE=MergeTree() ORDER BY value")
|
|
assert "Table system.part_log doesn't exist" in node1.query_and_get_error("SELECT * FROM system.part_log")
|
|
node1.query("INSERT INTO test_table VALUES ('name', 1)")
|
|
time.sleep(10)
|
|
assert "Table system.part_log doesn't exist" in node1.query_and_get_error("SELECT * FROM system.part_log")
|
|
|
|
def test_config_with_standard_part_log(start_cluster):
|
|
assert "Table system.part_log doesn't exist" in node2.query_and_get_error("SELECT * FROM system.part_log")
|
|
node2.query("CREATE TABLE test_table(word String, value UInt64) ENGINE=MergeTree() Order by value")
|
|
assert "Table system.part_log doesn't exist" in node2.query_and_get_error("SELECT * FROM system.part_log")
|
|
node2.query("INSERT INTO test_table VALUES ('name', 1)")
|
|
time.sleep(10)
|
|
assert node2.query("SELECT * FROM system.part_log") != ""
|
|
|
|
def test_config_with_non_standard_part_log(start_cluster):
|
|
assert "Table system.table_name doesn't exist" in node3.query_and_get_error("SELECT * FROM system.table_name")
|
|
node3.query("CREATE TABLE test_table(word String, value UInt64) ENGINE=MergeTree() Order by value")
|
|
assert "Table system.table_name doesn't exist" in node3.query_and_get_error("SELECT * FROM system.table_name")
|
|
node3.query("INSERT INTO test_table VALUES ('name', 1)")
|
|
time.sleep(10)
|
|
assert node3.query("SELECT * FROM system.table_name") != ""
|
|
|