mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Add test
This commit is contained in:
parent
2da43012b6
commit
f29261741c
6
tests/integration/test_log_levels_update/configs/log.xml
Normal file
6
tests/integration/test_log_levels_update/configs/log.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<yandex>
|
||||
<logger>
|
||||
<level>trace</level>
|
||||
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
|
||||
</logger>
|
||||
</yandex>
|
50
tests/integration/test_log_levels_update/test.py
Normal file
50
tests/integration/test_log_levels_update/test.py
Normal file
@ -0,0 +1,50 @@
|
||||
import pytest
|
||||
import re
|
||||
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
|
||||
cluster = ClickHouseCluster(__file__, name="log_quries_probability")
|
||||
node = cluster.add_instance('node', with_zookeeper=False)
|
||||
|
||||
config = '''<yandex>
|
||||
<logger>
|
||||
<level>information</level>
|
||||
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
|
||||
</logger>
|
||||
</yandex>'''
|
||||
|
||||
|
||||
@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 test_log_levels_update(start_cluster):
|
||||
# Make sure that there are enough log messages for the test
|
||||
for i in range(5):
|
||||
node.query("SELECT 1")
|
||||
|
||||
log = get_log(node)
|
||||
assert re.search("(<Trace>|<Debug>)", 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 i in range(5):
|
||||
node.query("SELECT 1")
|
||||
|
||||
log = get_log(node)
|
||||
assert len(log) > 0
|
||||
assert not re.search("(<Trace>|<Debug>)", log)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user