mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
StorageReplicatedMergeTree - improve integration test
This commit is contained in:
parent
806334a642
commit
48bf65d63d
@ -1,14 +0,0 @@
|
|||||||
<yandex>
|
|
||||||
<remote_servers>
|
|
||||||
<test_cluster>
|
|
||||||
<shard>
|
|
||||||
<internal_replication>true</internal_replication>
|
|
||||||
<replica>
|
|
||||||
<default_database>shard_0</default_database>
|
|
||||||
<host>node1</host>
|
|
||||||
<port>9000</port>
|
|
||||||
</replica>
|
|
||||||
</shard>
|
|
||||||
</test_cluster>
|
|
||||||
</remote_servers>
|
|
||||||
</yandex>
|
|
@ -12,11 +12,11 @@ from helpers.network import PartitionManager
|
|||||||
# 3. Try creating the table and there would be a Poco:Exception.
|
# 3. Try creating the table and there would be a Poco:Exception.
|
||||||
# 4. Try creating the table again and there should not be any error
|
# 4. Try creating the table again and there should not be any error
|
||||||
# that indicates that the Directory for table already exists.
|
# that indicates that the Directory for table already exists.
|
||||||
|
# 5. Final step is to restore ZooKeeper connection and verify that
|
||||||
|
# the table creation and queries work.
|
||||||
def test_replicated_zk_conn_failure():
|
def test_replicated_zk_conn_failure():
|
||||||
cluster = ClickHouseCluster(__file__)
|
cluster = ClickHouseCluster(__file__)
|
||||||
node1 = cluster.add_instance('node1', main_configs=["configs/remote_servers.xml"], with_zookeeper=True)
|
node1 = cluster.add_instance('node1', with_zookeeper=True)
|
||||||
try:
|
try:
|
||||||
cluster.start()
|
cluster.start()
|
||||||
node1.query("CREATE DATABASE replica;")
|
node1.query("CREATE DATABASE replica;")
|
||||||
@ -27,7 +27,7 @@ def test_replicated_zk_conn_failure():
|
|||||||
)
|
)
|
||||||
Engine=ReplicatedMergeTree('/clickhouse/tables/replica/test', 'node1')
|
Engine=ReplicatedMergeTree('/clickhouse/tables/replica/test', 'node1')
|
||||||
PARTITION BY toYYYYMMDD(event_time)
|
PARTITION BY toYYYYMMDD(event_time)
|
||||||
ORDER BY id;'''.format(replica=node1.name)
|
ORDER BY id;'''
|
||||||
with PartitionManager() as pm:
|
with PartitionManager() as pm:
|
||||||
pm.drop_instance_zk_connections(node1)
|
pm.drop_instance_zk_connections(node1)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
@ -41,5 +41,10 @@ def test_replicated_zk_conn_failure():
|
|||||||
# Should not expect any errors related to directory already existing
|
# Should not expect any errors related to directory already existing
|
||||||
# and those should have been already cleaned up during the previous retry.
|
# and those should have been already cleaned up during the previous retry.
|
||||||
assert "Directory for table data data/replica/test/ already exists" not in error
|
assert "Directory for table data data/replica/test/ already exists" not in error
|
||||||
|
# restore ZooKeeper connections.
|
||||||
|
pm.restore_instance_zk_connections(node1)
|
||||||
|
# retry create query and query the table created.
|
||||||
|
node1.query(query_create)
|
||||||
|
assert "0\n" in node1.query('''SELECT count() from replica.test FORMAT TSV''')
|
||||||
finally:
|
finally:
|
||||||
cluster.shutdown()
|
cluster.shutdown()
|
||||||
|
Loading…
Reference in New Issue
Block a user