Merge pull request #33926 from ClickHouse/fix_flaky_test

Fix test_replica_is_active flaky test
This commit is contained in:
alesapin 2022-01-24 10:19:10 +03:00 committed by GitHub
commit 48c19e88a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
import pytest
from helpers.client import QueryRuntimeException
from helpers.cluster import ClickHouseCluster
from ast import literal_eval
cluster = ClickHouseCluster(__file__)
node1 = cluster.add_instance('node1', with_zookeeper=True)
@ -30,12 +31,12 @@ def start_cluster():
def test_replica_is_active(start_cluster):
query_result = node1.query("select replica_is_active from system.replicas where table = 'test_table'")
assert query_result == '{\'node1\':1,\'node2\':1,\'node3\':1}\n'
assert literal_eval(query_result) == {'node1': 1, 'node2': 1, 'node3': 1}
node3.stop()
query_result = node1.query("select replica_is_active from system.replicas where table = 'test_table'")
assert query_result == '{\'node1\':1,\'node2\':1,\'node3\':0}\n'
assert literal_eval(query_result) == {'node1': 1, 'node2': 1, 'node3': 0}
node2.stop()
query_result = node1.query("select replica_is_active from system.replicas where table = 'test_table'")
assert query_result == '{\'node1\':1,\'node2\':0,\'node3\':0}\n'
assert literal_eval(query_result) == {'node1': 1, 'node2': 0, 'node3': 0}