From: Arran Cudbard-Bell Date: Thu, 13 Apr 2023 07:43:41 +0000 (+1000) Subject: redis: Fix node fail test to be more reliable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2b685786fbad1a20ff543ba81848f107eaef3c8;p=thirdparty%2Ffreeradius-server.git redis: Fix node fail test to be more reliable --- diff --git a/src/tests/modules/redis/cluster_node_fail.unlang b/src/tests/modules/redis/cluster_node_fail.unlang index 9a7867f837..3775c324fa 100644 --- a/src/tests/modules/redis/cluster_node_fail.unlang +++ b/src/tests/modules/redis/cluster_node_fail.unlang @@ -8,28 +8,34 @@ if (!("%(redis:SET b 'boom')" == 'OK')) { test_fail } -# Leave some time (100ms) for the synchronisation -&Tmp-String-0 := `/bin/sleep 0.1` +# Leave some time (500ms) for the synchronisation +%(delay:0.5) # Note the current master &Tmp-String-1 := %(redis_node:b 0) +# Note the current replica +&Tmp-String-2 := %(redis_node:b 1) + # Cause one of the redis cluster nodes to SEGV if ("%(redis:@%(redis_node:b 0) DEBUG SEGFAULT)" != '') { test_fail } # Forcefully failover the slave for that node -if (!("%(redis:@%(redis_node:b 1) CLUSTER FAILOVER TAKEOVER)" == 'OK')) { +if (!("%(redis:@%{Tmp-String-2} 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-String-1) { + # Keep remapping the cluster + %(redis_remap:%{Tmp-String-2}) + + if (%(redis_node:b 0) == &Tmp-String-2) { break } - &Tmp-String-0 := `/bin/sleep 0.5` + %(delay:0.5) } if (!("%(redis:GET b)" == 'boom')) { @@ -42,6 +48,7 @@ if ("%(redis:@%(redis_node:b) DEBUG SEGFAULT)" != '') { } # No alternatives... +%(delay:0.5) if ("%(redis:GET b)" == 'boom') { test_fail }