From: Nick Porter Date: Thu, 29 Aug 2024 17:41:44 +0000 (+0100) Subject: Use current time rather than packet time in redis_ippool tests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84680f100d3b9108b7ef864cbe23454a9537f271;p=thirdparty%2Ffreeradius-server.git Use current time rather than packet time in redis_ippool tests Sometimes, bringing the cluster up takes long enough to cause the test to appear to fail. Packet time starts before the cluster is reset, rather than when the main test policy is run. --- diff --git a/src/tests/modules/redis_ippool/alloc.unlang b/src/tests/modules/redis_ippool/alloc.unlang index 5505546b49f..cd1657d9d8e 100644 --- a/src/tests/modules/redis_ippool/alloc.unlang +++ b/src/tests/modules/redis_ippool/alloc.unlang @@ -25,12 +25,12 @@ if !(&reply.Framed-IP-Address == 192.168.0.1) { # # Check ZSCORE # -if ((%redis('ZSCORE', "{%{control.IP-Pool.Name}}:pool", "%{reply.Framed-IP-Address}") - %l) < 20) { +if ((%redis('ZSCORE', "{%{control.IP-Pool.Name}}:pool", "%{reply.Framed-IP-Address}") - %c) < 20) { test_fail } # +2 - Some slop for macOS -if ((%redis('ZSCORE', "{%{control.IP-Pool.Name}}:pool", "%{reply.Framed-IP-Address}") - %l) > 42) { +if ((%redis('ZSCORE', "{%{control.IP-Pool.Name}}:pool", "%{reply.Framed-IP-Address}") - %c) > 42) { test_fail } diff --git a/src/tests/modules/redis_ippool/update.unlang b/src/tests/modules/redis_ippool/update.unlang index 428c6c6545f..c1765542efe 100644 --- a/src/tests/modules/redis_ippool/update.unlang +++ b/src/tests/modules/redis_ippool/update.unlang @@ -49,12 +49,12 @@ if !(&reply.Session-Timeout == 60) { } # 8. Check ZSCORE reflects that -if !((%redis(ZSCORE, {%{control.IP-Pool.Name}}:pool, %{reply.Framed-IP-Address}) - %l) > 50) { +if !((%redis(ZSCORE, {%{control.IP-Pool.Name}}:pool, %{reply.Framed-IP-Address}) - %c) > 50) { test_fail } # 9. -if !((%redis(ZSCORE, {%{control.IP-Pool.Name}}:pool, %{reply.Framed-IP-Address}) - %l) < 70) { +if !((%redis(ZSCORE, {%{control.IP-Pool.Name}}:pool, %{reply.Framed-IP-Address}) - %c) < 70) { test_fail }