Unverified Commit 37d761ba authored by Moti Cohen's avatar Moti Cohen Committed by GitHub
Browse files

Fix Sentinel reconnect test following ACL change (#10480)

Replace condition with wait_for_condition On "Verify sentinel that restarted 
failed to reconnect master after ACL change"

The reason we reach it, is because the test is fast enough to modify ACL and
test sentinel connection status with the server - before its scheduled operation
got the chance to update connection status with the server:
```
/* Perform scheduled operations for the specified Redis instance. */
void sentinelHandleRedisInstance(sentinelRedisInstance *ri) {
    /* ========== MONITORING HALF ============ */
    /* Every kind of instance */
    sentinelReconnectInstance(ri);
```
parent f25e688e
...@@ -97,17 +97,17 @@ test "Sentinels (re)connection following SENTINEL SET mymaster auth-pass" { ...@@ -97,17 +97,17 @@ test "Sentinels (re)connection following SENTINEL SET mymaster auth-pass" {
} }
test "Sentinels (re)connection following master ACL change" { test "Sentinels (re)connection following master ACL change" {
# 2 types of sentinels to test: # Three types of sentinels to test during ACL change:
# (re)started while master changed pwd. Manage to connect only after setting pwd # 1. (re)started Sentinel. Manage to connect only after setting new pwd
# 2. (up)dated Sentinel, get just before ACL change the new password
# 3. (un)touched 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 sent2re 0 set sent2re 0
# (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
# set new ACL password won't persist ACL pwd change, unlike legacy auth-pass
set sent2un 2 set sent2un 2
wait_for_sentinels_connect_servers wait_for_sentinels_connect_servers
# kill sentinel 'sent2re' and restart it after # kill sentinel 'sent2re' and restart it after ACL change
kill_instance sentinel $sent2re kill_instance sentinel $sent2re
# Update sentinel 'sent2up' with new user and pwd # Update sentinel 'sent2up' with new user and pwd
...@@ -120,9 +120,11 @@ test "Sentinels (re)connection following master ACL change" { ...@@ -120,9 +120,11 @@ test "Sentinels (re)connection following master ACL change" {
restart_instance sentinel $sent2re restart_instance sentinel $sent2re
# Verify sentinel that restarted failed to connect master # Verify sentinel that restarted failed to reconnect master
if {![string match "*disconnected*" [dict get [S $sent2re SENTINEL MASTER mymaster] flags]]} { wait_for_condition 100 50 {
fail "Expected: Sentinel to be disconnected from master due to wrong password" [string match "*disconnected*" [dict get [S $sent2re SENTINEL MASTER mymaster] flags]] != 0
} else {
fail "Expected: Sentinel to be disconnected from master due to wrong password"
} }
# Verify sentinel with updated password managed to connect (wait for sentinelTimer to reconnect) # Verify sentinel with updated password managed to connect (wait for sentinelTimer to reconnect)
......
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