2020-09-03 16:52:08 +00:00
|
|
|
import os
|
2024-09-27 10:19:39 +00:00
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2020-08-03 22:48:29 +00:00
|
|
|
from helpers.cluster import ClickHouseCluster
|
|
|
|
|
2020-09-03 16:52:08 +00:00
|
|
|
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
2020-08-03 22:48:29 +00:00
|
|
|
cluster = ClickHouseCluster(__file__)
|
2020-09-03 16:52:08 +00:00
|
|
|
node = cluster.add_instance("node")
|
2020-08-03 22:48:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="module", autouse=True)
|
|
|
|
def started_cluster():
|
|
|
|
try:
|
|
|
|
cluster.start()
|
|
|
|
yield cluster
|
|
|
|
|
|
|
|
finally:
|
|
|
|
cluster.shutdown()
|
|
|
|
|
|
|
|
|
2020-09-03 16:52:08 +00:00
|
|
|
def test_custom_settings():
|
|
|
|
node.copy_file_to_container(
|
|
|
|
os.path.join(SCRIPT_DIR, "configs/custom_settings.xml"),
|
|
|
|
"/etc/clickhouse-server/users.d/z.xml",
|
|
|
|
)
|
|
|
|
node.query("SYSTEM RELOAD CONFIG")
|
|
|
|
|
2020-08-03 22:48:29 +00:00
|
|
|
assert node.query("SELECT getSetting('custom_a')") == "-5\n"
|
|
|
|
assert node.query("SELECT getSetting('custom_b')") == "10000000000\n"
|
|
|
|
assert node.query("SELECT getSetting('custom_c')") == "-4.325\n"
|
|
|
|
assert node.query("SELECT getSetting('custom_d')") == "some text\n"
|
|
|
|
|
|
|
|
|
2020-09-03 16:52:08 +00:00
|
|
|
def test_illformed_setting():
|
|
|
|
node.copy_file_to_container(
|
|
|
|
os.path.join(SCRIPT_DIR, "configs/illformed_setting.xml"),
|
|
|
|
"/etc/clickhouse-server/users.d/z.xml",
|
|
|
|
)
|
|
|
|
error_message = "Couldn't restore Field from dump: 1"
|
|
|
|
assert error_message in node.query_and_get_error("SYSTEM RELOAD CONFIG")
|