summaryrefslogtreecommitdiff
path: root/tests/sentinel
diff options
context:
space:
mode:
authorMoti Cohen <moti.cohen@redis.com>2022-03-27 17:56:21 +0300
committerGitHub <noreply@github.com>2022-03-27 17:56:21 +0300
commit37d761ba299909007ad27368b07f0d293e59398b (patch)
tree72aaffa9a966124e446be6f1f000074f26ef2933 /tests/sentinel
parentf25e688e2acae8329ed97cab163fc4852e4dd5d2 (diff)
downloadredis-37d761ba299909007ad27368b07f0d293e59398b.tar.gz
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); ```
Diffstat (limited to 'tests/sentinel')
-rw-r--r--tests/sentinel/tests/03-runtime-reconf.tcl20
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/sentinel/tests/03-runtime-reconf.tcl b/tests/sentinel/tests/03-runtime-reconf.tcl
index 69086ffae..71525fc7c 100644
--- a/tests/sentinel/tests/03-runtime-reconf.tcl
+++ b/tests/sentinel/tests/03-runtime-reconf.tcl
@@ -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)