WIP: Add regression test on config reload

This commit is contained in:
Pervakov Grigory 2019-11-15 19:10:37 +03:00
parent 651e0f3a1c
commit ac1a92649c
4 changed files with 109 additions and 0 deletions

View File

@ -0,0 +1,31 @@
<?xml version="1.0"?>
<yandex>
<logger>
<level>trace</level>
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
<size>1000M</size>
<count>10</count>
</logger>
<tcp_port>9000</tcp_port>
<listen_host>127.0.0.1</listen_host>
<openSSL>
<client>
<cacheSessions>true</cacheSessions>
<verificationMode>none</verificationMode>
<invalidCertificateHandler>
<name>AcceptCertificateHandler</name>
</invalidCertificateHandler>
</client>
</openSSL>
<max_concurrent_queries>500</max_concurrent_queries>
<mark_cache_size>5368709120</mark_cache_size>
<path>./clickhouse/</path>
<users_config>users.xml</users_config>
<max_table_size_to_drop>1</max_table_size_to_drop>
<max_partition_size_to_drop>1</max_partition_size_to_drop>
</yandex>

View File

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<yandex>
<profiles>
<default>
</default>
</profiles>
<users>
<default>
<password></password>
<networks incl="networks" replace="replace">
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</default>
</users>
<quotas>
<default>
</default>
</quotas>
</yandex>

View File

@ -0,0 +1,55 @@
import time
import pytest
import sys
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_dir = os.path.join(SCRIPT_DIR, './_instances/node/configs')
@pytest.fixture(scope="module")
def start_cluster():
try:
cluster.start()
node.query("CREATE DATABASE chtest;")
node.query(
'''
CREATE TABLE chtest.reload_max_table_size (date Date, id UInt32)
ENGINE = MergeTree(date, id, 8192)
'''
)
node.query("INSERT INTO chtest.reload_max_table_size VALUES (now(), 0)")
yield cluster
finally:
#cluster.shutdown()
pass
def test_reload_max_table_size_to_drop(start_cluster):
config = open(config_dir + '/config.xml', 'r')
config_lines = config.readlines()
config.close()
error = node.get_query_request("DROP TABLE chtest.reload_max_table_size") # change to query_and_get_error after fix
print >> sys.stderr, 'error: ' + error.get_answer()
print >> sys.stderr, 'path: ' + config_dir
print >> sys.stderr, 'config: '
for line in config_lines:
print >> sys.stderr, line
assert error != "" # Crashes due to illigal config
config_lines = map(lambda line: line.replace("<max_table_size_to_drop>1", "<max_table_size_to_drop>1000000"),
config_lines)
config = open(config_dir + '/config.xml', 'w')
config.writelines(config_lines)
time.sleep(50000)
error = node.query_and_get_error("DROP TABLE chtest.reload_max_table_size")
assert error == ""