]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Move set inside of cluster setup loop in case it takes a while for the cluster to...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 7 Mar 2019 13:32:17 +0000 (21:32 +0800)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 7 Mar 2019 13:32:17 +0000 (21:32 +0800)
src/tests/modules/redis/cluster_reset.inc

index 1da8c143300e8fdd2995fad8fa4245224404505d..a1976df58970ed73ad2c2cfd35f038aaa7dabe96 100644 (file)
@@ -44,15 +44,6 @@ update control {
 #  Determine when initial synchronisation has been completed
 #
 
-#  Hashes to Redis cluster node master 0 (1)
-if (("%{redis:SET b '%{control:Tmp-String-0}'}" != 'OK') || \
-    ("%{redis:SET c '%{control:Tmp-String-1}'}" != 'OK') || \
-    ("%{redis:SET d '%{control:Tmp-String-2}'}" != 'OK')) {
-       test_fail
-} else {
-       test_pass
-}
-
 #  Test nodes should be running on
 #  - 127.0.0.1:30001 - master [0-5460]
 #  - 127.0.0.1:30004 - slave
@@ -68,13 +59,20 @@ foreach &control:Tmp-Integer-0 {
        #  Force a remap as the slaves don't show up in the cluster immediately
        #
        if ("%{redis_remap:%{Tmp-String-0}:30001}" == 'success') {
-               #  The actual node to keyslot mapping seems to be somewhat random
-               #  so we now need to figure out which slave each of those keys
-               #  ended up on.
-               if (("%{redis:-@%{redis_node:b 1} GET b}" == "%{control:Tmp-String-0}") && \
-                   ("%{redis:-@%{redis_node:c 1} GET c}" == "%{control:Tmp-String-1}") && \
-                   ("%{redis:-@%{redis_node:d 1} GET d}" == "%{control:Tmp-String-2}")) {
-                       break
+               #  Hashes to Redis cluster node master 0 (1)
+               if (("%{redis:SET b '%{control:Tmp-String-0}'}" == 'OK') && \
+                   ("%{redis:SET c '%{control:Tmp-String-1}'}" == 'OK') && \
+                   ("%{redis:SET d '%{control:Tmp-String-2}'}" == 'OK')) {
+                       #
+                       #  The actual node to keyslot mapping seems to be somewhat random
+                       #  so we now need to figure out which slave each of those keys
+                       #  ended up on.
+                       #
+                       if (("%{redis:-@%{redis_node:b 1} GET b}" == "%{control:Tmp-String-0}") && \
+                           ("%{redis:-@%{redis_node:c 1} GET c}" == "%{control:Tmp-String-1}") && \
+                           ("%{redis:-@%{redis_node:d 1} GET d}" == "%{control:Tmp-String-2}")) {
+                               break
+                       }
                }
 
                update request {