summaryrefslogtreecommitdiffstats
path: root/tests/support/cluster_util.tcl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-04 17:58:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-04 17:58:41 +0000
commitd7bc17f61954de2a29ab751e53ee1ce90d3a49e1 (patch)
treec9320c4588fc639b2c5aacf878edd67bccebfc57 /tests/support/cluster_util.tcl
parentAdding upstream version 5:7.2.4. (diff)
downloadredis-upstream.tar.xz
redis-upstream.zip
Adding upstream version 5:7.2.5.upstream/5%7.2.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/support/cluster_util.tcl')
-rw-r--r--tests/support/cluster_util.tcl27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/support/cluster_util.tcl b/tests/support/cluster_util.tcl
index 2e3611e..5160466 100644
--- a/tests/support/cluster_util.tcl
+++ b/tests/support/cluster_util.tcl
@@ -199,3 +199,30 @@ proc are_hostnames_propagated {match_string} {
}
return 1
}
+
+proc wait_node_marked_fail {ref_node_index instance_id_to_check} {
+ wait_for_condition 1000 50 {
+ [check_cluster_node_mark fail $ref_node_index $instance_id_to_check]
+ } else {
+ fail "Replica node never marked as FAIL ('fail')"
+ }
+}
+
+proc wait_node_marked_pfail {ref_node_index instance_id_to_check} {
+ wait_for_condition 1000 50 {
+ [check_cluster_node_mark fail\? $ref_node_index $instance_id_to_check]
+ } else {
+ fail "Replica node never marked as PFAIL ('fail?')"
+ }
+}
+
+proc check_cluster_node_mark {flag ref_node_index instance_id_to_check} {
+ set nodes [get_cluster_nodes $ref_node_index]
+
+ foreach n $nodes {
+ if {[dict get $n id] eq $instance_id_to_check} {
+ return [cluster_has_flag $n $flag]
+ }
+ }
+ fail "Unable to find instance id in cluster nodes. ID: $instance_id_to_check"
+}