Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(clickhouse): wait on desired state, not intermediary #373

Merged
merged 4 commits into from May 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 12 additions & 11 deletions ci/kubetest/test_clickhouse_sharding.py
@@ -1,3 +1,5 @@
import time

import pytest
import yaml

Expand Down Expand Up @@ -48,17 +50,16 @@ def test_upgrading_to_more_shards(kube):
new_values["clickhouse"]["layout"]["shardsCount"] = 3

install_chart(new_values)
wait_for_pods_to_be_ready(
kube,
labels={
"clickhouse.altinity.com/namespace": "posthog",
"clickhouse.altinity.com/chi": "posthog",
},
expected_count=6,
)

# Validate the ClickHouse node setup
number_of_hosts, table_counts = get_clickhouse_table_counts_on_all_nodes(kube)

# Wait for new replicas to come up and for tables to be created
start = time.time()
while time.time() - start < 120:
number_of_hosts, table_counts = get_clickhouse_table_counts_on_all_nodes(kube)
if number_of_hosts == 6 and len(set(table_counts)) == 1:
break

time.sleep(5)

assert number_of_hosts == 6
assert len(set(table_counts)) == 1, "Schemas on some ClickHouse nodes are out of sync"
assert table_counts[0] >= 31