ClickHouse/tests/integration/test_system_logs_comment/test.py

51 lines
1.3 KiB
Python
Raw Normal View History

# pylint: disable=line-too-long
# pylint: disable=unused-argument
# pylint: disable=redefined-outer-name
import pytest
2024-09-27 10:19:39 +00:00
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
2022-03-23 19:41:28 +00:00
node = cluster.add_instance("node_default", stay_alive=True)
2022-03-23 19:41:28 +00:00
@pytest.fixture(scope="module", autouse=True)
def start_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
def test_system_logs_comment():
2022-03-23 19:41:28 +00:00
node.exec_in_container(
[
"bash",
"-c",
f"""echo "
<clickhouse>
<query_log>
<engine>ENGINE = MergeTree
PARTITION BY (event_date)
ORDER BY (event_time)
TTL event_date + INTERVAL 14 DAY DELETE
SETTINGS ttl_only_drop_parts=1
COMMENT 'test_comment'
</engine>
<partition_by remove='remove'/>
</query_log>
</clickhouse>
" > /etc/clickhouse-server/config.d/yyy-override-query_log.xml
2022-03-23 19:41:28 +00:00
""",
]
)
node.restart_clickhouse()
node.query("select 1")
node.query("system flush logs")
comment = node.query("SELECT comment FROM system.tables WHERE name = 'query_log'")
2022-03-23 19:41:28 +00:00
assert comment == "test_comment\n"