ClickHouse/tests/integration/test_atomic_drop_table/test.py

38 lines
1.1 KiB
Python
Raw Normal View History

2019-08-09 11:17:33 +00:00
import time
import pytest
from helpers.network import PartitionManager
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node1 = cluster.add_instance('node1', config_dir="configs", with_zookeeper=True)
@pytest.fixture(scope="module")
def start_cluster():
try:
cluster.start()
2020-01-28 19:39:52 +00:00
node1.query("CREATE DATABASE zktest ENGINE=Ordinary;")
2019-08-09 11:17:33 +00:00
node1.query(
'''
CREATE TABLE zktest.atomic_drop_table (n UInt32)
ENGINE = ReplicatedMergeTree('/clickhouse/zktest/tables/atomic_drop_table', 'node1')
PARTITION BY n ORDER BY n
'''
)
yield cluster
finally:
cluster.shutdown()
def test_atomic_delete_with_stopped_zookeeper(start_cluster):
node1.query("insert into zktest.atomic_drop_table values (8192)")
with PartitionManager() as pm:
pm.drop_instance_zk_connections(node1)
2019-08-09 12:58:46 +00:00
error = node1.query_and_get_error("DROP TABLE zktest.atomic_drop_table") #Table won't drop
2019-08-09 11:17:33 +00:00
assert error != ""
time.sleep(5)
assert '8192' in node1.query("select * from zktest.atomic_drop_table")