Merge pull request #21674 from azat/fix-flaky-test_replace_partition

Fix flaky test_replace_partition
This commit is contained in:
alexey-milovidov 2021-03-14 14:11:11 +03:00 committed by GitHub
commit f1223e7548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,8 @@
# pylint: disable=line-too-long
# pylint: disable=unused-argument
# pylint: disable=redefined-outer-name:
import time
import pytest
from helpers.cluster import ClickHouseCluster
@ -97,12 +102,13 @@ def test_drop_failover(drop_failover):
# Drop partition on source node
node3.query("ALTER TABLE test_table DROP PARTITION 201706")
# connection restored
# Wait few seconds for connection to zookeeper to be restored
time.sleep(5)
node4.query_with_retry("select last_exception from system.replication_queue where type = 'REPLACE_RANGE'",
check_callback=lambda x: 'Not found part' not in x, sleep_time=1)
assert 'Not found part' not in node4.query(
"select last_exception from system.replication_queue where type = 'REPLACE_RANGE'")
msg = node4.query_with_retry(
"select last_exception from system.replication_queue where type = 'REPLACE_RANGE'",
check_callback=lambda x: 'Not found part' not in x, sleep_time=1)
assert 'Not found part' not in msg
assert_eq_with_retry(node4, "SELECT id FROM test_table order by id", '')
@ -151,8 +157,11 @@ def test_replace_after_replace_failover(replace_after_replace_failover):
assert_eq_with_retry(node5, "SELECT id FROM test_table order by id", '333')
node6.query_with_retry("select last_exception from system.replication_queue where type = 'REPLACE_RANGE'",
check_callback=lambda x: 'Not found part' not in x, sleep_time=1)
assert 'Not found part' not in node6.query(
"select last_exception from system.replication_queue where type = 'REPLACE_RANGE'")
# Wait few seconds for connection to zookeeper to be restored
time.sleep(5)
msg = node6.query_with_retry(
"select last_exception from system.replication_queue where type = 'REPLACE_RANGE'",
check_callback=lambda x: 'Not found part' not in x, sleep_time=1)
assert 'Not found part' not in msg
assert_eq_with_retry(node6, "SELECT id FROM test_table order by id", '333')