2021-05-21 13:29:43 +00:00
|
|
|
import time
|
|
|
|
import pytest
|
|
|
|
from helpers.cluster import ClickHouseCluster
|
|
|
|
|
|
|
|
cluster = ClickHouseCluster(__file__, name="password")
|
|
|
|
|
|
|
|
# TODO ACL not implemented in Keeper.
|
2022-03-22 16:39:58 +00:00
|
|
|
node1 = cluster.add_instance(
|
|
|
|
"node1",
|
|
|
|
with_zookeeper=True,
|
|
|
|
main_configs=[
|
|
|
|
"configs/remote_servers.xml",
|
|
|
|
"configs/zookeeper_config_with_password.xml",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
node2 = cluster.add_instance(
|
|
|
|
"node2", with_zookeeper=True, main_configs=["configs/remote_servers.xml"]
|
|
|
|
)
|
|
|
|
|
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):
|
2022-03-22 16:39:58 +00:00
|
|
|
node1.query("DROP TABLE IF EXISTS simple SYNC")
|
2021-06-16 12:31:19 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
node1.query(
|
|
|
|
"""
|
2021-05-21 13:29:43 +00:00
|
|
|
CREATE TABLE simple (date Date, id UInt32)
|
|
|
|
ENGINE = ReplicatedMergeTree('/clickhouse/tables/0/simple', '{replica}', date, id, 8192);
|
2022-03-22 16:39:58 +00:00
|
|
|
""".format(
|
|
|
|
replica=node1.name
|
|
|
|
)
|
|
|
|
)
|
2021-05-21 13:29:43 +00:00
|
|
|
|
|
|
|
with pytest.raises(Exception):
|
2022-03-22 16:39:58 +00:00
|
|
|
node2.query(
|
|
|
|
"""
|
2021-05-21 13:29:43 +00:00
|
|
|
CREATE TABLE simple (date Date, id UInt32)
|
|
|
|
ENGINE = ReplicatedMergeTree('/clickhouse/tables/0/simple', '1', date, id, 8192);
|
2022-03-22 16:39:58 +00:00
|
|
|
"""
|
|
|
|
)
|