summaryrefslogtreecommitdiff
path: root/tests/sentinel/tests
diff options
context:
space:
mode:
authorMoti Cohen <moti.cohen@redis.com>2022-03-28 12:40:52 +0300
committerGitHub <noreply@github.com>2022-03-28 12:40:52 +0300
commit63f77698cf3b48b8d3bc1cb18e35fd257bb30fe8 (patch)
tree5465042f82a68086c0efac27ac325dbfd8415b48 /tests/sentinel/tests
parentae771ea77b1eb7b55444fd6189d9db77cb724990 (diff)
downloadredis-63f77698cf3b48b8d3bc1cb18e35fd257bb30fe8.tar.gz
Fix sentinel test SDOWN is triggered by non-responding instance (#10484)
A timing issue of debug sleep master isn't long enough to ensure that master is down and let the test identify it. Replaced the code with suspend PID until verified master-is-down.
Diffstat (limited to 'tests/sentinel/tests')
-rw-r--r--tests/sentinel/tests/07-down-conditions.tcl9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl
index e7e33a29a..bb24d6dff 100644
--- a/tests/sentinel/tests/07-down-conditions.tcl
+++ b/tests/sentinel/tests/07-down-conditions.tcl
@@ -24,7 +24,6 @@ proc ensure_master_up {} {
}
}
-
proc ensure_master_down {} {
S $::alive_sentinel sentinel debug info-period 1000
S $::alive_sentinel sentinel debug ping-period 100
@@ -45,10 +44,14 @@ test "Crash the majority of Sentinels to prevent failovers for this unit" {
}
test "SDOWN is triggered by non-responding but not crashed instance" {
- lassign [S $::alive_sentinel SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] host port
ensure_master_up
- exec ../../../src/redis-cli -h $host -p $port {*}[rediscli_tls_config "../../../tests"] debug sleep 3 > /dev/null &
+ set master_addr [S $::alive_sentinel SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set master_id [get_instance_id_by_port redis [lindex $master_addr 1]]
+
+ set pid [get_instance_attrib redis $master_id pid]
+ exec kill -SIGSTOP $pid
ensure_master_down
+ exec kill -SIGCONT $pid
ensure_master_up
}