Files
zooqueen fce0ee72e1 datastore: fix XML config tag mismatch (</clickhouse> closing tags)
Runtime regression from the final lowercase pass: it renamed <clickhouse> opening tags to
<datastore> but the / exclusion (protecting /clickhouse paths) left </clickhouse> closing tags,
so embedded + shipped configs became <datastore>...</clickhouse> -> SAXParseException 'Tag
mismatch' at runtime (compile was fine; XML is data). Renamed all <clickhouse/</clickhouse XML
tags -> datastore (101 closes across configs, embedded strings, keeper configs). Path strings
(/var/lib/clickhouse) have no angle bracket and are untouched. Build compiled; this fixes runtime
config parsing.
2026-06-22 00:25:01 -07:00

68 lines
1.7 KiB
Python

import re
import pytest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance(
"node", with_zookeeper=False, main_configs=["configs/log.xml"]
)
config = """<datastore>
<logger>
<level>debug</level>
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
</logger>
</datastore>"""
@pytest.fixture(scope="module")
def start_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
def get_log(node):
return node.exec_in_container(
["bash", "-c", "cat /var/log/clickhouse-server/clickhouse-server.log"]
)
def check_it_will_work_slowly(node, log):
it_will_work_slowly = "It will work slowly"
if node.is_built_with_sanitizer() or node.is_debug_build():
# message still in logs
re.search(f"<Warning>.*{it_will_work_slowly}", log)
# but not in system.warnings
query = f"SELECT count() FROM system.warnings WHERE message ILIKE '%{it_will_work_slowly}%'"
assert 0 == int(node.query(query).strip())
def test_log_levels_update(start_cluster):
# Make sure that there are enough log messages for the test
for _ in range(5):
node.query("SELECT 1")
log = get_log(node)
assert re.search("(<Trace>|<Debug>)", log)
check_it_will_work_slowly(node, log)
node.replace_config("/etc/clickhouse-server/config.d/log.xml", config)
node.query("SYSTEM RELOAD CONFIG;")
node.exec_in_container(
["bash", "-c", "> /var/log/clickhouse-server/clickhouse-server.log"]
)
for _ in range(5):
node.query("SELECT 1")
log = get_log(node)
assert len(log) > 0
assert not re.search("<Trace>", log)