Skip to content

Commit 397a143

Browse files
committed
Fix znode_exists flakiness in test_refreshable_mv_in_replicated_db
1 parent 16579a9 commit 397a143

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

tests/integration/helpers/cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
from helpers import pytest_xdist_logging_to_separate_files
5858
from helpers.client import QueryRuntimeException
59-
from helpers.test_tools import assert_eq_with_retry, exec_query_with_retry
59+
from helpers.test_tools import exec_query_with_retry
6060

6161
from .client import Client
6262
from .config_cluster import *

tests/integration/test_refreshable_mv/test.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,7 @@ def test_refreshable_mv_in_replicated_db(started_cluster):
162162
)
163163

164164
# Locate coordination znodes.
165-
znode_exists = (
166-
lambda uuid: nodes[randint(0, 1)].query(
167-
f"select count() from system.zookeeper where path = '/clickhouse/tables/{uuid}' and name = 'shard1'"
168-
)
169-
== "1\n"
170-
)
165+
znode_exists_query = lambda uuid: f"select count() from system.zookeeper where path = '/clickhouse/tables/{uuid}' and name = 'shard1'"
171166
tables = []
172167
for row in node1.query(
173168
"select table, uuid from system.tables where database = 're'"
@@ -178,7 +173,8 @@ def test_refreshable_mv_in_replicated_db(started_cluster):
178173
continue
179174
coordinated = not name.endswith("uncoordinated")
180175
tables.append((name, uuid, coordinated))
181-
assert coordinated == znode_exists(uuid)
176+
znode_exists = nodes[randint(0, 1)].query(znode_exists_query(uuid)) == '1\n'
177+
assert coordinated == znode_exists
182178
assert sorted([name for (name, _, _) in tables]) == [
183179
"a",
184180
"append",
@@ -194,7 +190,7 @@ def test_refreshable_mv_in_replicated_db(started_cluster):
194190
nodes[randint(0, 1)].query(f"drop table re.{name}{' sync' if sync else ''}")
195191
# TODO: After https://github.com/ClickHouse/ClickHouse/issues/61065 is done (for MVs, not ReplicatedMergeTree), check the parent znode instead.
196192
if sync:
197-
assert not znode_exists(uuid)
193+
assert_eq_with_retry(nodes[randint(0, 1)], znode_exists_query(uuid), '0\n')
198194

199195
# A little stress test dropping MV while it's refreshing, hoping to hit various cases where the
200196
# drop happens while creating/exchanging/dropping the inner table.

0 commit comments

Comments
 (0)