ClickHouse/dbms/tests/integration/test_reload_max_table_size_to_drop/test.py
Grigory Pervakov 1f1e25dceb Update dbms/tests/integration/test_reload_max_table_size_to_drop/test.py
Co-Authored-By: Alexander Burmak <Alex-Burmak@yandex-team.ru>
2019-11-25 14:42:09 +03:00

50 lines
1.3 KiB
Python

import time
import pytest
import os
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance('node', config_dir="configs")
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
CONFIG_PATH = os.path.join(SCRIPT_DIR, './_instances/node/configs/config.xml')
@pytest.fixture(scope="module")
def start_cluster():
try:
cluster.start()
node.query("CREATE TABLE test(date Date, id UInt32) ENGINE = MergeTree(date, id, 8192)")
yield cluster
finally:
cluster.shutdown()
def test_reload_max_table_size_to_drop(start_cluster):
node.query("INSERT INTO test VALUES (now(), 0)")
time.sleep(5) # wait for data part commit
drop = node.get_query_request("DROP TABLE test")
out, err = drop.get_answer_and_error()
assert out == ""
assert err != ""
config = open(CONFIG_PATH, 'r')
config_lines = config.readlines()
config.close()
config_lines = map(lambda line: line.replace("<max_table_size_to_drop>1", "<max_table_size_to_drop>1000000"),
config_lines)
config = open(CONFIG_PATH, 'w')
config.writelines(config_lines)
config.close()
node.query("SYSTEM RELOAD CONFIG")
drop = node.get_query_request("DROP TABLE test")
out, err = drop.get_answer_and_error()
assert out == ""
assert err == ""