mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-15 12:14:18 +00:00
Fix and simplify test
This commit is contained in:
parent
1e59e2932b
commit
339c8fd949
@ -0,0 +1,3 @@
|
||||
<clickhouse>
|
||||
<display_name>424242</display_name>
|
||||
</clickhouse>
|
@ -1,11 +0,0 @@
|
||||
<clickhouse>
|
||||
<kafka>
|
||||
<debug>consumer</debug>
|
||||
<consumer>
|
||||
<kafka_topic>
|
||||
<name>config_test</name>
|
||||
<session_timeout_ms>424242</session_timeout_ms>
|
||||
</kafka_topic>
|
||||
</consumer>
|
||||
</kafka>
|
||||
</clickhouse>
|
@ -1,15 +1,11 @@
|
||||
import pytest
|
||||
|
||||
from helpers.cluster import ClickHouseCluster, is_arm
|
||||
|
||||
if is_arm():
|
||||
pytestmark = pytest.mark.skip
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
instance = cluster.add_instance(
|
||||
"instance",
|
||||
main_configs=["configs/kafka.xml"],
|
||||
with_kafka=True,
|
||||
main_configs=["configs/display_name.xml"],
|
||||
stay_alive=True,
|
||||
)
|
||||
|
||||
@ -24,48 +20,22 @@ def start_cluster():
|
||||
|
||||
|
||||
DEFAULT_VALUE = "424242"
|
||||
CHANGED_VALUE = "414141"
|
||||
|
||||
|
||||
def check_value(value):
|
||||
instance.query(
|
||||
f"""
|
||||
CREATE TABLE test (x Int64) ENGINE = Kafka
|
||||
SETTINGS
|
||||
kafka_broker_list = '{cluster.kafka_host}:{cluster.kafka_port}',
|
||||
kafka_topic_list = 'config_test',
|
||||
kafka_group_name = 'config_test_group',
|
||||
kafka_format = 'JSON';
|
||||
"""
|
||||
)
|
||||
|
||||
instance.query(
|
||||
"SELECT * FROM test SETTINGS stream_like_engine_allow_direct_select=1",
|
||||
ignore_error=True,
|
||||
)
|
||||
|
||||
assert instance.wait_for_log_line("Consumer set property session.timeout.ms")
|
||||
instance.query("DROP TABLE test SYNC")
|
||||
|
||||
instance.contains_in_log(f"Consumer set property session.timeout.ms:{value}")
|
||||
CHANGED_VALUE = "434343"
|
||||
|
||||
|
||||
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.query("DROP TABLE IF EXISTS test SYNC")
|
||||
instance.replace_in_config(
|
||||
"/etc/clickhouse-server/config.d/kafka.xml", CHANGED_VALUE, DEFAULT_VALUE
|
||||
"/etc/clickhouse-server/config.d/display_name.xml", CHANGED_VALUE, DEFAULT_VALUE
|
||||
)
|
||||
instance.restart_clickhouse()
|
||||
|
||||
check_value(DEFAULT_VALUE)
|
||||
|
||||
instance.rotate_logs()
|
||||
assert DEFAULT_VALUE == instance.query("SELECT displayName()").strip()
|
||||
|
||||
instance.replace_in_config(
|
||||
"/etc/clickhouse-server/config.d/kafka.xml", DEFAULT_VALUE, CHANGED_VALUE
|
||||
"/etc/clickhouse-server/config.d/display_name.xml", DEFAULT_VALUE, CHANGED_VALUE
|
||||
)
|
||||
|
||||
instance.query("SYSTEM RELOAD CONFIG")
|
||||
|
||||
check_value(CHANGED_VALUE)
|
||||
assert CHANGED_VALUE == instance.query("SELECT displayName()").strip()
|
||||
|
Loading…
Reference in New Issue
Block a user