test: yaml merge keys

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Eduard Karacharov 2024-05-02 19:07:04 +03:00 committed by Azat Khuzhin
parent 439229ef2b
commit 4770446dbe
3 changed files with 109 additions and 0 deletions

View File

@ -0,0 +1,41 @@
---
settings_common: &settings_common
max_threads: 1
max_final_threads: 1
settings_extended: &settings_extended
max_final_threads: 2
profiles:
profile_1:
<<: *settings_common
profile_2:
<<: *settings_common
max_threads: 4
profile_3:
max_threads: 4
<<: *settings_common
profile_4:
<<: *settings_common
<<: *settings_extended
max_threads: 4
profile_5:
<<: [*settings_common, *settings_extended]
max_threads: 4
users:
user_1:
profile: profile_1
password: ""
user_2:
profile: profile_2
password: ""
user_3:
profile: profile_3
password: ""
user_4:
profile: profile_4
password: ""
user_5:
profile: profile_5
password: ""

View File

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