2021-05-21 13:29:43 +00:00
|
|
|
import time
|
2024-09-27 10:19:39 +00:00
|
|
|
|
2021-05-21 13:29:43 +00:00
|
|
|
import pytest
|
2024-09-27 10:19:39 +00:00
|
|
|
|
2021-05-21 13:29:43 +00:00
|
|
|
from helpers.cluster import ClickHouseCluster
|
|
|
|
|
2022-07-18 12:25:14 +00:00
|
|
|
cluster = ClickHouseCluster(__file__)
|
2021-05-21 13:29:43 +00:00
|
|
|
|
|
|
|
# TODO ACL not implemented in Keeper.
|
2021-05-31 04:12:22 +00:00
|
|
|
node1 = cluster.add_instance(
|
|
|
|
"node1",
|
|
|
|
with_zookeeper=True,
|
2021-05-21 13:29:43 +00:00
|
|
|
main_configs=[
|
|
|
|
"configs/remote_servers.xml",
|
|
|
|
"configs/zookeeper_config_with_password.xml",
|
2022-03-22 16:39:58 +00:00
|
|
|
],
|
2021-05-21 13:29:43 +00:00
|
|
|
)
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2021-05-31 04:12:22 +00:00
|
|
|
node2 = cluster.add_instance(
|
|
|
|
"node2", with_zookeeper=True, main_configs=["configs/remote_servers.xml"]
|
|
|
|
)
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2021-05-21 13:29:43 +00:00
|
|
|
|
|
|
|
@pytest.fixture(scope="module", autouse=True)
|
|
|
|
def started_cluster():
|
|
|
|
try:
|
|
|
|
cluster.start()
|
|
|
|
yield cluster
|
|
|
|
|
|
|
|
finally:
|
|
|
|
cluster.shutdown()
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2021-05-21 13:29:43 +00:00
|
|
|
def test_identity(started_cluster):
|
2021-06-16 12:31:19 +00:00
|
|
|
node1.query("DROP TABLE IF EXISTS simple SYNC")
|
|
|
|
|
2021-05-21 13:29:43 +00:00
|
|
|
node1.query(
|
2022-03-22 16:39:58 +00:00
|
|
|
"""
|
2021-05-21 13:29:43 +00:00
|
|
|
CREATE TABLE simple (date Date, id UInt32)
|
2022-06-23 08:37:52 +00:00
|
|
|
ENGINE = ReplicatedMergeTree('/clickhouse/tables/0/simple', '{replica}') PARTITION BY toYYYYMM(date) ORDER BY id;
|
2021-05-21 13:29:43 +00:00
|
|
|
""".format(
|
|
|
|
replica=node1.name
|
|
|
|
)
|
2022-03-22 16:39:58 +00:00
|
|
|
)
|
2021-05-21 13:29:43 +00:00
|
|
|
|
|
|
|
with pytest.raises(Exception):
|
|
|
|
node2.query(
|
2022-03-22 16:39:58 +00:00
|
|
|
"""
|
2021-05-21 13:29:43 +00:00
|
|
|
CREATE TABLE simple (date Date, id UInt32)
|
2022-06-23 08:37:52 +00:00
|
|
|
ENGINE = ReplicatedMergeTree('/clickhouse/tables/0/simple', '1') PARTITION BY toYYYYMM(date) ORDER BY id;
|
2022-03-22 16:39:58 +00:00
|
|
|
"""
|
2021-05-21 13:29:43 +00:00
|
|
|
)
|