mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
CLICLKHOUSE-3847 add test
This commit is contained in:
parent
a569d88e6a
commit
8c10c11804
@ -10,7 +10,7 @@ def fill_nodes(nodes, shard):
|
|||||||
CREATE DATABASE test;
|
CREATE DATABASE test;
|
||||||
|
|
||||||
CREATE TABLE test_table(date Date, id UInt32)
|
CREATE TABLE test_table(date Date, id UInt32)
|
||||||
ENGINE = ReplicatedMergeTree('/clickhouse/tables/test{shard}/replicated', '{replica}', date, id, 8192);
|
ENGINE = ReplicatedMergeTree('/clickhouse/tables/test{shard}/replicated', '{replica}') ORDER BY id PARTITION BY toYYYYMM(date) SETTINGS min_replicated_logs_to_keep=3, max_replicated_logs_to_keep=5;
|
||||||
'''.format(shard=shard, replica=node.name))
|
'''.format(shard=shard, replica=node.name))
|
||||||
|
|
||||||
cluster = ClickHouseCluster(__file__)
|
cluster = ClickHouseCluster(__file__)
|
||||||
@ -18,7 +18,7 @@ node1 = cluster.add_instance('node1', main_configs=['configs/remote_servers.xml'
|
|||||||
node2 = cluster.add_instance('node2', main_configs=['configs/remote_servers.xml'], with_zookeeper=True)
|
node2 = cluster.add_instance('node2', main_configs=['configs/remote_servers.xml'], with_zookeeper=True)
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def start_cluster_cluster():
|
def start_cluster():
|
||||||
try:
|
try:
|
||||||
cluster.start()
|
cluster.start()
|
||||||
|
|
||||||
@ -26,10 +26,13 @@ def start_cluster_cluster():
|
|||||||
|
|
||||||
yield cluster
|
yield cluster
|
||||||
|
|
||||||
|
except Exception as ex:
|
||||||
|
print ex
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
cluster.shutdown()
|
cluster.shutdown()
|
||||||
|
|
||||||
def test_both_https(start_cluster_cluster):
|
def test_recovery(start_cluster):
|
||||||
node1.query("INSERT INTO test_table VALUES (1, 1)")
|
node1.query("INSERT INTO test_table VALUES (1, 1)")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
node2.query("DETACH TABLE test_table")
|
node2.query("DETACH TABLE test_table")
|
||||||
@ -37,10 +40,10 @@ def test_both_https(start_cluster_cluster):
|
|||||||
for i in range(100):
|
for i in range(100):
|
||||||
node1.query("INSERT INTO test_table VALUES (1, {})".format(i))
|
node1.query("INSERT INTO test_table VALUES (1, {})".format(i))
|
||||||
|
|
||||||
time.sleep(20)
|
time.sleep(80)
|
||||||
|
|
||||||
node2.query("ATTACH TABLE test_table")
|
node2.query("ATTACH TABLE test_table")
|
||||||
|
|
||||||
time.sleep(10)
|
time.sleep(30)
|
||||||
|
|
||||||
assert node1.query("SELECT count(*) FROM test_table") == node2.query("SELECT count(*) FROM test_table")
|
assert node1.query("SELECT count(*) FROM test_table") == node2.query("SELECT count(*) FROM test_table")
|
||||||
|
Loading…
Reference in New Issue
Block a user