Sentinel: Fix failed daily tests, due to race condition (#9501)

This commit is contained in:
Wen Hui 2021-09-15 06:39:50 -04:00 committed by GitHub
parent 157454ffa4
commit 53ad5627b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -18,9 +18,9 @@ test "Basic failover works if the master is down" {
assert {[lindex $addr 1] == $old_port}
kill_instance redis $master_id
foreach_sentinel_id id {
S $id sentinel debug ping-period 100
S $id sentinel debug ask-period 100
wait_for_condition 1000 50 {
S $id sentinel debug ping-period 500
S $id sentinel debug ask-period 500
wait_for_condition 1000 100 {
[lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port
} else {
fail "At least one Sentinel did not receive failover info"
@ -101,7 +101,7 @@ test "Failover works if we configure for absolute agreement" {
# Wait for Sentinels to monitor the master again
foreach_sentinel_id id {
wait_for_condition 1000 50 {
wait_for_condition 1000 100 {
[dict get [S $id SENTINEL MASTER mymaster] info-refresh] < 100000
} else {
fail "At least one Sentinel is not monitoring the master"
@ -111,7 +111,7 @@ test "Failover works if we configure for absolute agreement" {
kill_instance redis $master_id
foreach_sentinel_id id {
wait_for_condition 1000 50 {
wait_for_condition 1000 100 {
[lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port
} else {
fail "At least one Sentinel did not receive failover info"

View File

@ -3,6 +3,14 @@
source "../tests/includes/init-tests.tcl"
source "../../../tests/support/cli.tcl"
foreach_sentinel_id id {
S $id sentinel debug info-period 1000
S $id sentinel debug ask-period 100
S $id sentinel debug default-down-after 3000
S $id sentinel debug publish-period 200
S $id sentinel debug ping-period 100
}
set ::alive_sentinel [expr {$::instances_count/2+2}]
proc ensure_master_up {} {
S $::alive_sentinel sentinel debug info-period 1000
@ -69,7 +77,9 @@ test "SDOWN is triggered by misconfigured instance replying with errors" {
R 0 config set dir /
R 0 config set dbfilename tmp
R 0 config set save "1000000 1000000"
after 5000
R 0 bgsave
after 5000
ensure_master_down
R 0 config set save $orig_save
R 0 config set dir $orig_dir