2024-05-02 16:07:04 +00:00
|
|
|
import helpers
|
|
|
|
import pytest
|
|
|
|
from helpers.cluster import ClickHouseCluster
|
|
|
|
|
|
|
|
|
|
|
|
def test_yaml_merge_keys_conf():
|
|
|
|
cluster = ClickHouseCluster(__file__)
|
2024-05-03 12:22:43 +00:00
|
|
|
node = cluster.add_instance("node", user_configs=["configs/merge_keys.yml"])
|
2024-05-02 16:07:04 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
cluster.start()
|
|
|
|
|
|
|
|
# Assert simple merge key substitution
|
2024-05-03 12:22:43 +00:00
|
|
|
assert node.query("select getSetting('max_threads')", user="user_1") == "1\n"
|
2024-05-02 16:07:04 +00:00
|
|
|
|
|
|
|
# Assert merge key overriden by regular key
|
2024-05-03 12:22:43 +00:00
|
|
|
assert node.query("select getSetting('max_threads')", user="user_2") == "4\n"
|
2024-05-02 16:07:04 +00:00
|
|
|
|
|
|
|
# Assert normal key overriden by merge key
|
2024-05-03 12:22:43 +00:00
|
|
|
assert node.query("select getSetting('max_threads')", user="user_3") == "4\n"
|
2024-05-02 16:07:04 +00:00
|
|
|
|
|
|
|
# Assert override with multiple merge keys
|
2024-05-03 12:22:43 +00:00
|
|
|
assert (
|
|
|
|
node.query("select getSetting('max_final_threads')", user="user_4") == "2\n"
|
2024-05-02 16:07:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# Assert multiple merge key substitutions overriden by regular key
|
2024-05-03 12:22:43 +00:00
|
|
|
assert node.query("select getSetting('max_threads')", user="user_4") == "4\n"
|
2024-05-02 16:07:04 +00:00
|
|
|
|
|
|
|
# Assert override with multiple merge keys for list syntax
|
2024-05-03 12:22:43 +00:00
|
|
|
assert (
|
|
|
|
node.query("select getSetting('max_final_threads')", user="user_5") == "2\n"
|
2024-05-02 16:07:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# Assert multiple merge key substitutions overriden by regular key
|
|
|
|
# for list syntax
|
2024-05-03 12:22:43 +00:00
|
|
|
assert node.query("select getSetting('max_threads')", user="user_5") == "4\n"
|
2024-05-02 16:07:04 +00:00
|
|
|
finally:
|
|
|
|
cluster.shutdown()
|