Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
53ad5627
Unverified
Commit
53ad5627
authored
Sep 15, 2021
by
Wen Hui
Committed by
GitHub
Sep 15, 2021
Browse files
Sentinel: Fix failed daily tests, due to race condition (#9501)
parent
157454ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/sentinel/tests/00-base.tcl
View file @
53ad5627
...
@@ -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
1
00
S $id sentinel debug ping-period
5
00
S $id sentinel debug ask-period
1
00
S $id sentinel debug ask-period
5
00
wait_for_condition 1000
5
0
{
wait_for_condition 1000
10
0
{
[
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
5
0
{
wait_for_condition 1000
10
0
{
[
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
5
0
{
wait_for_condition 1000
10
0
{
[
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"
...
...
tests/sentinel/tests/07-down-conditions.tcl
View file @
53ad5627
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment