less flaky test_keeper_mntr_data_size

This commit is contained in:
Antonio Andelic 2023-04-04 12:56:39 +00:00
parent 18c1e2709d
commit a164adc0b4
2 changed files with 22 additions and 10 deletions

View File

@ -1,5 +1,6 @@
<clickhouse>
<keeper_server>
<use_cluster>false</use_cluster>
<tcp_port>9181</tcp_port>
<server_id>1</server_id>
<log_storage_path>/var/lib/clickhouse/coordination/log</log_storage_path>

View File

@ -61,28 +61,39 @@ def test_mntr_data_size_after_restart(started_cluster):
node_zk.close()
node_zk = None
def get_line_from_mntr(key):
def get_line_from_mntr(mntr_str, key):
return next(
filter(
lambda line: key in line,
keeper_utils.send_4lw_cmd(started_cluster, node, "mntr").split(
"\n"
),
mntr_str.split("\n"),
),
None,
)
line_size_before = get_line_from_mntr("zk_approximate_data_size")
node_count_before = get_line_from_mntr("zk_znode_count")
assert get_line_from_mntr("zk_ephemerals_count") == "zk_ephemerals_count\t0"
mntr_result = keeper_utils.send_4lw_cmd(started_cluster, node, "mntr")
line_size_before = get_line_from_mntr(mntr_result, "zk_approximate_data_size")
node_count_before = get_line_from_mntr(mntr_result, "zk_znode_count")
assert (
get_line_from_mntr(mntr_result, "zk_ephemerals_count")
== "zk_ephemerals_count\t0"
)
assert line_size_before != None
restart_clickhouse()
def assert_mntr_stats():
assert get_line_from_mntr("zk_ephemerals_count") == "zk_ephemerals_count\t0"
assert get_line_from_mntr("zk_znode_count") == node_count_before
assert get_line_from_mntr("zk_approximate_data_size") == line_size_before
mntr_result = keeper_utils.send_4lw_cmd(started_cluster, node, "mntr")
assert (
get_line_from_mntr(mntr_result, "zk_ephemerals_count")
== "zk_ephemerals_count\t0"
)
assert (
get_line_from_mntr(mntr_result, "zk_znode_count") == node_count_before
)
assert (
get_line_from_mntr(mntr_result, "zk_approximate_data_size")
== line_size_before
)
assert_mntr_stats()
keeper_utils.send_4lw_cmd(started_cluster, node, "rclc")