Fix integration tests

This commit is contained in:
Antonio Andelic 2022-07-20 07:55:19 +00:00
parent a3e00faaf9
commit 84ef2c9a1f
2 changed files with 12 additions and 7 deletions

View File

@ -227,8 +227,8 @@ def test_cmd_mntr(started_cluster):
# contains: # contains:
# 10 nodes created by test # 10 nodes created by test
# 3 nodes created by clickhouse "/clickhouse/task_queue/ddl" # 3 nodes created by clickhouse "/clickhouse/task_queue/ddl"
# 1 root node # 1 root node, 2 keeper system nodes
assert int(result["zk_znode_count"]) == 11 assert int(result["zk_znode_count"]) == 13
assert int(result["zk_watch_count"]) == 2 assert int(result["zk_watch_count"]) == 2
assert int(result["zk_ephemerals_count"]) == 2 assert int(result["zk_ephemerals_count"]) == 2
assert int(result["zk_approximate_data_size"]) > 0 assert int(result["zk_approximate_data_size"]) > 0
@ -369,7 +369,7 @@ def test_cmd_srvr(started_cluster):
assert int(result["Connections"]) == 1 assert int(result["Connections"]) == 1
assert int(result["Zxid"]) > 14 assert int(result["Zxid"]) > 14
assert result["Mode"] == "leader" assert result["Mode"] == "leader"
assert result["Node count"] == "11" assert result["Node count"] == "13"
finally: finally:
destroy_zk_client(zk) destroy_zk_client(zk)
@ -407,7 +407,7 @@ def test_cmd_stat(started_cluster):
assert int(result["Connections"]) == 1 assert int(result["Connections"]) == 1
assert int(result["Zxid"]) > 14 assert int(result["Zxid"]) > 14
assert result["Mode"] == "leader" assert result["Mode"] == "leader"
assert result["Node count"] == "11" assert result["Node count"] == "13"
# filter connection statistics # filter connection statistics
cons = [n for n in data.split("\n") if "=" in n] cons = [n for n in data.split("\n") if "=" in n]

View File

@ -193,11 +193,16 @@ def compare_states(zk1, zk2, path="/", exclude_paths=[]):
second_children = list(sorted(zk2.get_children(path))) second_children = list(sorted(zk2.get_children(path)))
print("Got children left", first_children) print("Got children left", first_children)
print("Got children rigth", second_children) print("Got children rigth", second_children)
assert first_children == second_children, "Childrens are not equal on path " + path
if path == "/":
assert set(first_children) ^ set(second_children) == set(["keeper"])
else:
assert first_children == second_children, "Childrens are not equal on path " + path
for children in first_children: for children in first_children:
print("Checking child", os.path.join(path, children)) if path != "/" or children != "keeper":
compare_states(zk1, zk2, os.path.join(path, children), exclude_paths) print("Checking child", os.path.join(path, children))
compare_states(zk1, zk2, os.path.join(path, children), exclude_paths)
@pytest.mark.parametrize(("create_snapshots"), [True, False]) @pytest.mark.parametrize(("create_snapshots"), [True, False])