Unverified Commit 871fa12f authored by Binbin's avatar Binbin Committed by GitHub
Browse files

Sentinel: fix reconnect test timing issue (#10424)

We need to wait for `sentinelTimer` to kick in, and then trigger the reconnect.

As for another change, we should better call `server_set_password` before calling SENTINEL SET auth-pass.

Fixes problem introeuced in #10400
parent 38ed6c60
...@@ -21,7 +21,7 @@ proc server_reset_password {} { ...@@ -21,7 +21,7 @@ proc server_reset_password {} {
} }
proc server_set_acl {id} { proc server_set_acl {id} {
assert_equal {OK} [R $id ACL SETUSER $::user on >$::password allchannels +@all ] assert_equal {OK} [R $id ACL SETUSER $::user on >$::password allchannels +@all]
assert_equal {OK} [R $id ACL SETUSER default off] assert_equal {OK} [R $id ACL SETUSER default off]
R $id CLIENT KILL USER default SKIPME no R $id CLIENT KILL USER default SKIPME no
...@@ -74,8 +74,8 @@ test "Sentinels (re)connection following SENTINEL SET mymaster auth-pass" { ...@@ -74,8 +74,8 @@ test "Sentinels (re)connection following SENTINEL SET mymaster auth-pass" {
wait_for_sentinels_connect_servers wait_for_sentinels_connect_servers
kill_instance sentinel $sent2re kill_instance sentinel $sent2re
assert_equal {OK} [S $sent2up SENTINEL SET mymaster auth-pass $::password]
server_set_password server_set_password
assert_equal {OK} [S $sent2up SENTINEL SET mymaster auth-pass $::password]
restart_instance sentinel $sent2re restart_instance sentinel $sent2re
# Verify sentinel that restarted failed to connect master # Verify sentinel that restarted failed to connect master
...@@ -102,7 +102,7 @@ test "Sentinels (re)connection following master ACL change" { ...@@ -102,7 +102,7 @@ test "Sentinels (re)connection following master ACL change" {
set sent2re 0 set sent2re 0
# (up)dated in advance with master new password # (up)dated in advance with master new password
set sent2up 1 set sent2up 1
# (un)touched. Note,sentinel that kept old connection with master and didn't # (un)touched. Note, sentinel that kept old connection with master and didn't
# set new ACL password won't persist ACL pwd change, unlike legacy auth-pass # set new ACL password won't persist ACL pwd change, unlike legacy auth-pass
set sent2un 2 set sent2un 2
...@@ -125,8 +125,10 @@ test "Sentinels (re)connection following master ACL change" { ...@@ -125,8 +125,10 @@ test "Sentinels (re)connection following master ACL change" {
fail "Expected: Sentinel to be disconnected from master due to wrong password" fail "Expected: Sentinel to be disconnected from master due to wrong password"
} }
# Verify sentinel with updated password managed to connect # Verify sentinel with updated password managed to connect (wait for sentinelTimer to reconnect)
if {[string match "*disconnected*" [dict get [S $sent2up SENTINEL MASTER mymaster] flags]]} { wait_for_condition 100 50 {
[string match "*disconnected*" [dict get [S $sent2up SENTINEL MASTER mymaster] flags]] == 0
} else {
fail "Expected: Sentinel to be connected to master" fail "Expected: Sentinel to be connected to master"
} }
......
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