]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Allow redis cluster time to propagate changes after failover
authorNick Porter <nick@portercomputing.co.uk>
Wed, 1 Feb 2023 20:54:02 +0000 (20:54 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 2 Feb 2023 08:13:21 +0000 (08:13 +0000)
src/tests/modules/redis/cluster_node_fail.unlang

index c54d338afdb50db49fa3e8701c58a968dbb667e1..07ffff8040809a2afa766d383dca315ccf9f2112 100644 (file)
@@ -11,6 +11,9 @@ if (!("%(redis:SET b 'boom')" == 'OK')) {
 #  Leave some time (100ms) for the synchronisation
 &Tmp-String-0 := `/bin/sleep 0.1`
 
+#  Note the current master
+&Tmp-Integer-0 := %(redis_node:b 0)
+
 #  Cause one of the redis cluster nodes to SEGV
 if ("%(redis:@%(redis_node:b 0) DEBUG SEGFAULT)" != '') {
        test_fail
@@ -21,6 +24,14 @@ if (!("%(redis:@%(redis_node:b 1) CLUSTER FAILOVER TAKEOVER)" == 'OK')) {
        test_fail
 }
 
+#  Allow time for the takeover to propagate to other nodes
+foreach &control.Tmp-Integer-0 {
+       if (%(redis_node:b 0) != &Tmp-Integer-0) {
+               break
+       }
+       &Tmp-String-0 := `/bin/sleep 0.5`
+}
+
 if (!("%(redis:GET b)" == 'boom')) {
        test_fail
 }