Unverified Commit 53ad5627 authored by Wen Hui's avatar Wen Hui Committed by GitHub
Browse files

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

parent 157454ff
...@@ -18,9 +18,9 @@ test "Basic failover works if the master is down" { ...@@ -18,9 +18,9 @@ test "Basic failover works if the master is down" {
assert {[lindex $addr 1] == $old_port} assert {[lindex $addr 1] == $old_port}
kill_instance redis $master_id kill_instance redis $master_id
foreach_sentinel_id id { foreach_sentinel_id id {
S $id sentinel debug ping-period 100 S $id sentinel debug ping-period 500
S $id sentinel debug ask-period 100 S $id sentinel debug ask-period 500
wait_for_condition 1000 50 { wait_for_condition 1000 100 {
[lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port
} else { } else {
fail "At least one Sentinel did not receive failover info" fail "At least one Sentinel did not receive failover info"
...@@ -101,7 +101,7 @@ test "Failover works if we configure for absolute agreement" { ...@@ -101,7 +101,7 @@ test "Failover works if we configure for absolute agreement" {
# Wait for Sentinels to monitor the master again # Wait for Sentinels to monitor the master again
foreach_sentinel_id id { foreach_sentinel_id id {
wait_for_condition 1000 50 { wait_for_condition 1000 100 {
[dict get [S $id SENTINEL MASTER mymaster] info-refresh] < 100000 [dict get [S $id SENTINEL MASTER mymaster] info-refresh] < 100000
} else { } else {
fail "At least one Sentinel is not monitoring the master" fail "At least one Sentinel is not monitoring the master"
...@@ -111,7 +111,7 @@ test "Failover works if we configure for absolute agreement" { ...@@ -111,7 +111,7 @@ test "Failover works if we configure for absolute agreement" {
kill_instance redis $master_id kill_instance redis $master_id
foreach_sentinel_id 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 [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port
} else { } else {
fail "At least one Sentinel did not receive failover info" fail "At least one Sentinel did not receive failover info"
......
...@@ -3,6 +3,14 @@ ...@@ -3,6 +3,14 @@
source "../tests/includes/init-tests.tcl" source "../tests/includes/init-tests.tcl"
source "../../../tests/support/cli.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}] set ::alive_sentinel [expr {$::instances_count/2+2}]
proc ensure_master_up {} { proc ensure_master_up {} {
S $::alive_sentinel sentinel debug info-period 1000 S $::alive_sentinel sentinel debug info-period 1000
...@@ -69,7 +77,9 @@ test "SDOWN is triggered by misconfigured instance replying with errors" { ...@@ -69,7 +77,9 @@ test "SDOWN is triggered by misconfigured instance replying with errors" {
R 0 config set dir / R 0 config set dir /
R 0 config set dbfilename tmp R 0 config set dbfilename tmp
R 0 config set save "1000000 1000000" R 0 config set save "1000000 1000000"
after 5000
R 0 bgsave R 0 bgsave
after 5000
ensure_master_down ensure_master_down
R 0 config set save $orig_save R 0 config set save $orig_save
R 0 config set dir $orig_dir R 0 config set dir $orig_dir
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment