summaryrefslogtreecommitdiff
path: root/tests/sentinel
diff options
context:
space:
mode:
authorWen Hui <wen.hui.ware@gmail.com>2021-09-15 06:39:50 -0400
committerGitHub <noreply@github.com>2021-09-15 13:39:50 +0300
commit53ad5627b7c0fd846590c97b9647fd4ed379d289 (patch)
treee8cc03668615dd5419f364ec7a1ed0becd109443 /tests/sentinel
parent157454ffa4388143f9d68753d0a94bc684010367 (diff)
downloadredis-53ad5627b7c0fd846590c97b9647fd4ed379d289.tar.gz
Sentinel: Fix failed daily tests, due to race condition (#9501)
Diffstat (limited to 'tests/sentinel')
-rw-r--r--tests/sentinel/tests/00-base.tcl10
-rw-r--r--tests/sentinel/tests/07-down-conditions.tcl10
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