@@ -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