]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
redis: Fix timing issues in cluster reset
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 13 Apr 2023 07:11:06 +0000 (17:11 +1000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 13 Apr 2023 08:29:39 +0000 (18:29 +1000)
It takes 5-6 seconds for replicas to appear in the output of cluster slots

src/tests/modules/redis/cluster_reset.inc
src/tests/modules/redis/module.conf

index 4de08936394d660c4901f6a7c2abdfcd28dcfb81..ae4a42a0d787b2841305d2b3902958bfe609d602 100644 (file)
        &Tmp-Integer-0 = 8
        &Tmp-Integer-0 = 9
        &Tmp-Integer-0 = 10
+       &Tmp-Integer-0 = 11
+       &Tmp-Integer-0 = 12
+       &Tmp-Integer-0 = 13
+       &Tmp-Integer-0 = 14
+       &Tmp-Integer-0 = 15
+       &Tmp-Integer-0 = 16
+       &Tmp-Integer-0 = 17
+       &Tmp-Integer-0 = 18
+       &Tmp-Integer-0 = 19
+       &Tmp-Integer-0 = 20
+       &Tmp-Integer-0 = 21
 }
 
 &control.Tmp-String-0 := "1-%{randstr:aaaaaaaa}"
@@ -75,15 +86,18 @@ foreach &control.Tmp-Integer-0 {
 
        &request -= &Module-Failure-Message[*]
 
-       # Perform checks every 0.5 seconds
-       &Tmp-Integer-0 := `/bin/sleep 0.5`
+       # Perform checks every half second for 10 seconds.
+       #
+       # The cluster tends to come up within a couple of seconds, but it takes longer
+       # for the replicas to be displayed in cluster slot output (usually ~5 seconds).
+       %(delay:0.5)
 
        #
        #  If the cluster is still not behaving
        #  abandon the test to avoid false negatives
        #
-       if ("%{Foreach-Variable-0}" == 10) {
-               test_pass
+       if ("%{Foreach-Variable-0}" == 20) {
+               test_fail
                return
        }
 }
index abcdfae952ad74b3eb81ec1c92d3a85548ca4bcd..8d5173c8b6f85a100d9ffe99cccd24de4b75ba9b 100644 (file)
@@ -93,3 +93,6 @@ redis {
                #  or increase lifetime/idle_timeout.
        }
 }
+
+delay {
+}