2020-08-11 13:38:25 +00:00
|
|
|
import pytest
|
|
|
|
from helpers.cluster import ClickHouseCluster
|
2020-09-16 16:53:58 +00:00
|
|
|
import logging
|
|
|
|
|
|
|
|
cluster = ClickHouseCluster(__file__)
|
|
|
|
node = cluster.add_instance("node", main_configs=["configs/config.xml"], with_zookeeper=True)
|
2020-08-11 13:38:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
2020-09-16 16:53:58 +00:00
|
|
|
def start_cluster():
|
2020-08-11 13:38:25 +00:00
|
|
|
try:
|
|
|
|
logging.info("Starting cluster...")
|
|
|
|
cluster.start()
|
|
|
|
logging.info("Cluster started")
|
|
|
|
|
|
|
|
yield cluster
|
|
|
|
finally:
|
|
|
|
cluster.shutdown()
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
2020-09-16 16:53:58 +00:00
|
|
|
def drop_table(start_cluster):
|
2020-08-11 13:38:25 +00:00
|
|
|
yield
|
|
|
|
for node in cluster.instances.values():
|
|
|
|
node.query("DROP TABLE IF EXISTS test1")
|
|
|
|
node.query("DROP TABLE IF EXISTS test2")
|
|
|
|
|
|
|
|
|
2020-09-16 16:53:58 +00:00
|
|
|
def test_replicated_merge_tree_settings(start_cluster):
|
2020-08-11 13:38:25 +00:00
|
|
|
node.query("CREATE TABLE test1 (id Int64) ENGINE MergeTree ORDER BY id")
|
|
|
|
node.query(
|
|
|
|
"CREATE TABLE test2 (id Int64) ENGINE ReplicatedMergeTree('/clickhouse/test', 'test') ORDER BY id"
|
|
|
|
)
|
|
|
|
|
2020-09-17 08:48:27 +00:00
|
|
|
assert "index_granularity = 100" in node.query("SHOW CREATE test1")
|
|
|
|
assert "index_granularity = 200" in node.query("SHOW CREATE test2")
|