Skip to content

Commit bb83c84

Browse files
Merge pull request ClickHouse#80274 from ClickHouse/syncs
Fix more flakiness in test_refreshable_mv
2 parents 3f879c4 + 6c9d4c0 commit bb83c84

File tree

1 file changed

+9
-2
lines changed
  • tests/integration/test_refreshable_mv

1 file changed

+9
-2
lines changed

tests/integration/test_refreshable_mv/test.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import pytest
66

7-
from helpers.cluster import ClickHouseCluster
7+
from helpers.cluster import ClickHouseCluster, QueryRuntimeException
88
from helpers.network import PartitionManager
99
from helpers.test_tools import assert_eq_with_retry, assert_logs_contain
1010

@@ -354,8 +354,13 @@ def test_pause(started_cluster, cleanup):
354354
assert node2.query("select * from re.a") == "1\n"
355355
node2.query("system stop replicated view re.a")
356356
node1.restart_clickhouse() # just to guarantee that it notices the new znode
357+
try:
358+
node2.query("system wait view re.a")
359+
except QueryRuntimeException as ex:
360+
# If the node1.restart_clickhouse() interrupted a refresh, the error message (with substring
361+
# "cancelled") is written to keeper, then thrown by "system wait view". That's normal.
362+
assert "cancelled" in str(ex)
357363
node2.query(
358-
"system wait view re.a;"
359364
"truncate table re.src;"
360365
"insert into re.src values (2);")
361366
time.sleep(3)
@@ -415,6 +420,8 @@ def do_test_backup(to_table):
415420

416421
assert node1.query(tables_exist_query) == "2\n"
417422
assert node2.query(tables_exist_query) == "2\n"
423+
node1.query(f'SYSTEM SYNC REPLICA re.{target}')
424+
node2.query(f'SYSTEM SYNC REPLICA re.{target}')
418425
assert node1.query(f'SELECT * FROM re.{target}') == '1\n'
419426
assert node2.query(f'SELECT * FROM re.{target}') == '1\n'
420427

0 commit comments

Comments
 (0)