From 53ad5627b7c0fd846590c97b9647fd4ed379d289 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Wed, 15 Sep 2021 06:39:50 -0400 Subject: [PATCH] Sentinel: Fix failed daily tests, due to race condition (#9501) --- tests/sentinel/tests/00-base.tcl | 10 +++++----- tests/sentinel/tests/07-down-conditions.tcl | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/sentinel/tests/00-base.tcl b/tests/sentinel/tests/00-base.tcl index f00efc61e..1a9879a20 100644 --- a/tests/sentinel/tests/00-base.tcl +++ b/tests/sentinel/tests/00-base.tcl @@ -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" diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl index 2c72f8547..e7e33a29a 100644 --- a/tests/sentinel/tests/07-down-conditions.tcl +++ b/tests/sentinel/tests/07-down-conditions.tcl @@ -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