8000 test(e2e): wait for ClickHouse to reload config in test_010016 by jsc0218 · Pull Request #2169 · Altinity/clickhouse-operator · GitHub
[go: up one dir, main page]

Skip to content
< 8000 /div>
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/e2e/clickhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ def wait_config_applied(chi_name, user, retries=30, delay=5, pwd="", host="127.0
return False


def wait_query_result(chi_name, sql, expected, retries=15, delay=2, **kwargs):
"""Poll until a query returns the expected output; return the last output."""
for i in range(retries):
out = query_with_error(chi_name, sql, **kwargs)
if out == expected:
break
time.sleep(delay)
return out


def wait_config_denied(chi_name, user, retries=30, delay=5, pwd="", host="127.0.0.1"):
"""Poll ClickHouse until a user becomes unavailable after config change."""
for i in range(retries):
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2442,12 +2442,12 @@ def test_010016(self):
)

with Then("Custom macro 'layer' should change the value"):
out = clickhouse.query(chi, sql="select substitution from system.macros where macro='layer'")
assert out == "03"
out = clickhouse.wait_query_result(chi, "select substitution from system.macros where macro='layer'", "03")
assert out == "03", error()

with And("Dictionary 'three' should exist"):
out = clickhouse.query(chi, sql="select dictGet('three', 'three', toUInt64(0))")
assert out == "0"
out = clickhouse.wait_query_result(chi, "select dictGet('three', 'three', toUInt64(0))", "0")
assert out == "0", error()

with And("ClickHouse SHOULD NOT BE restarted"):
new_start_time = kubectl.get_clickhouse_start(chi)
Expand Down
0