ClickHouse/tests/integration/test_keeper_dynamic_log_level/test.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

91 lines
2.0 KiB
Python
Raw Normal View History

2023-06-09 11:55:22 +00:00
import sys
2024-09-27 10:19:39 +00:00
import time
import pytest
2023-06-09 11:55:22 +00:00
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance(
"node",
main_configs=[
"configs/keeper_config.xml",
"configs/logger.xml",
],
stay_alive=True,
)
@pytest.fixture(scope="module")
def start_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
def test_adjust_log_level(start_cluster):
assert (
int(
node.exec_in_container(
[
"bash",
"-c",
2023-06-13 07:05:05 +00:00
"grep '<Trace>' /var/log/clickhouse-server/clickhouse-server.log | wc -l",
2023-06-09 11:55:22 +00:00
],
privileged=True,
user="root",
)
2023-06-09 12:45:40 +00:00
)
== 0
2023-06-09 11:55:22 +00:00
)
# Adjust log level.
node.exec_in_container(
[
"bash",
"-c",
"""echo "
<clickhouse>
<logger>
<level>trace</level>
2023-06-13 07:05:05 +00:00
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
2023-06-09 11:55:22 +00:00
<errorlog_level>error</errorlog_level>
2023-06-13 07:05:05 +00:00
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
2023-06-09 11:55:22 +00:00
<size>200M</size>
<count>10</count>
</logger>
</clickhouse>
" > /etc/clickhouse-server/config.d/logger.xml
""",
]
)
2023-08-23 11:50:27 +00:00
time.sleep(3)
2023-08-23 12:13:54 +00:00
node.query(
"SELECT * FROM system.zookeeper SETTINGS allow_unrestricted_reads_from_keeper = 'true'"
)
2023-06-09 11:55:22 +00:00
node.exec_in_container(
[
"bash",
"-c",
"sync",
],
privileged=True,
user="root",
)
assert (
int(
node.exec_in_container(
[
"bash",
"-c",
2023-06-13 07:05:05 +00:00
"grep '<Trace>' /var/log/clickhouse-server/clickhouse-server.log | wc -l",
2023-06-09 11:55:22 +00:00
],
privileged=True,
user="root",
)
2023-06-09 12:45:40 +00:00
)
>= 1
2023-06-09 11:55:22 +00:00
)