ClickHouse/tests/integration/test_config_reload/test.py

42 lines
1.1 KiB
Python
Raw Normal View History

2024-10-28 17:36:32 +00:00
import pytest
2024-10-29 23:09:37 +00:00
from helpers.cluster import ClickHouseCluster
2024-10-28 17:36:32 +00:00
cluster = ClickHouseCluster(__file__)
instance = cluster.add_instance(
"instance",
2024-10-29 23:09:37 +00:00
main_configs=["configs/display_name.xml"],
2024-10-28 17:36:32 +00:00
stay_alive=True,
)
@pytest.fixture(scope="module")
def start_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
DEFAULT_VALUE = "424242"
2024-10-29 23:09:37 +00:00
CHANGED_VALUE = "434343"
2024-10-28 17:36:32 +00:00
def test_system_reload_config_with_global_context(start_cluster):
# When running the this test multiple times, make sure failure of one test won't cause the failure of every subsequent tests
instance.replace_in_config(
2024-10-29 23:09:37 +00:00
"/etc/clickhouse-server/config.d/display_name.xml", CHANGED_VALUE, DEFAULT_VALUE
2024-10-28 17:36:32 +00:00
)
instance.restart_clickhouse()
2024-10-29 23:09:37 +00:00
assert DEFAULT_VALUE == instance.query("SELECT displayName()").strip()
2024-10-28 17:36:32 +00:00
instance.replace_in_config(
2024-10-29 23:09:37 +00:00
"/etc/clickhouse-server/config.d/display_name.xml", DEFAULT_VALUE, CHANGED_VALUE
2024-10-28 17:36:32 +00:00
)
instance.query("SYSTEM RELOAD CONFIG")
2024-10-29 23:09:37 +00:00
assert CHANGED_VALUE == instance.query("SELECT displayName()").strip()