8000 test: fix flaky Keeper reconnect check in test_010064 by Slach · Pull Request #2143 · Altinity/clickhouse-operator · GitHub
[go: up one dir, main page]

Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- uses: actions/setup-python@v5
id: setup-python
with:
python-version: '3.13'
python-version: '3.12'

- name: Cache python
uses: actions/cache@v6
Expand Down
13 changes: 8 additions & 5 deletions tests/e2e/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6897,10 +6897,13 @@ def test_010064(self):
# satisfy the not-restarted asserts below without ever having read a timestamp. A missing
# pod raises IndexError inside the helper instead, which fails loudly on its own.
assert start_time != "", error("could not read the ClickHouse container start time")
connected_time = ""
# Compare the session id, not connected_time: ClickHouse computes connected_time at
# query time as now() - session uptime, both in whole seconds, so it jitters by 1s
# within the same session.
client_id = ""
with And("CHI is connected to Keeper"):
connected_time = clickhouse.query(chi, "SELECT connected_time from system.zookeeper_connection")
assert connected_time != ""
client_id = clickhouse.query(chi, "SELECT client_id from system.zookeeper_connection")
assert client_id != ""

with When("Trigger CHK reconcile by patching taskID"):
kubectl.force_chk_reconcile(chk, "keeper-watch-test")
Expand All @@ -6913,8 +6916,8 @@ def test_010064(self):
assert new_start_time == start_time, error("CHI has been restarted")

with Then("CHI does not reconnect to Keeper"):
new_connected_time = clickhouse.query(chi, "SELECT connected_time from system.zookeeper_connection")
assert new_connected_time == connected_time, error("ClickHouse reconnected to Keeper")
new_client_id = clickhouse.query(chi, "SELECT client_id from system.zookeeper_connection")
assert new_client_id == client_id, error("ClickHouse reconnected to Keeper")

with When("Rescale Keeper to 3 nodes"):
kubectl.create_and_check(
Expand Down
2 changes: 1 addition & 1 deletion tests/image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY --from=ghcr.io/astral-sh/uv:0.13.7 /uv /usr/local/bin/uv
ENV UV_PYTHON_INSTALL_DIR=/opt/python VIRTUAL_ENV=/opt/venv PATH=/opt/venv/bin:$PATH
COPY requirements.txt /home/master/requirements.txt
RUN uv venv --python 3.13 /opt/venv \
RUN uv venv --python 3.12 /opt/venv \
&& uv pip install -U -r /home/master/requirements.txt

RUN set -x \
Expand Down
Loading
0