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);
```
This commit is contained in:
Moti Cohen 2022-03-27 17:56:21 +03:00 committed by GitHub
parent f25e688e2a
commit 37d761ba29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,17 +97,17 @@ test "Sentinels (re)connection following SENTINEL SET mymaster auth-pass" {
}
test "Sentinels (re)connection following master ACL change" {
# 2 types of sentinels to test:
# (re)started while master changed pwd. Manage to connect only after setting pwd
# Three types of sentinels to test during ACL change:
# 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
# (up)dated in advance with master new password
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
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
# Update sentinel 'sent2up' with new user and pwd
@ -120,9 +120,11 @@ test "Sentinels (re)connection following master ACL change" {
restart_instance sentinel $sent2re
# Verify sentinel that restarted failed to connect master
if {![string match "*disconnected*" [dict get [S $sent2re SENTINEL MASTER mymaster] flags]]} {
fail "Expected: Sentinel to be disconnected from master due to wrong password"
# Verify sentinel that restarted failed to reconnect master
wait_for_condition 100 50 {
[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)