diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 14:11:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 14:11:00 +0000 |
commit | af754e596a8dbb05ed8580c342e7fe02e08b28e0 (patch) | |
tree | b2f334c2b55ede42081aa6710a72da784547d8ea /src/tests/keywords/redundant-load-balance | |
parent | Initial commit. (diff) | |
download | freeradius-af754e596a8dbb05ed8580c342e7fe02e08b28e0.tar.xz freeradius-af754e596a8dbb05ed8580c342e7fe02e08b28e0.zip |
Adding upstream version 3.2.3+dfsg.upstream/3.2.3+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tests/keywords/redundant-load-balance')
-rw-r--r-- | src/tests/keywords/redundant-load-balance | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/tests/keywords/redundant-load-balance b/src/tests/keywords/redundant-load-balance new file mode 100644 index 0000000..27721f1 --- /dev/null +++ b/src/tests/keywords/redundant-load-balance @@ -0,0 +1,65 @@ +# PRE: update if foreach +# +# Redundant blocks. +# +# The first one fails, so the second one is used +# +update request { + Tmp-Integer-0 := 0 + Tmp-Integer-1 += 0 + Tmp-Integer-1 += 1 + Tmp-Integer-1 += 2 + Tmp-Integer-1 += 3 + Tmp-Integer-1 += 4 + Tmp-Integer-1 += 5 + Tmp-Integer-1 += 6 + Tmp-Integer-1 += 7 + Tmp-Integer-1 += 8 + Tmp-Integer-1 += 9 + +} + +# +# Loop 0..9 +# +foreach &Tmp-Integer-1 { + redundant-load-balance { + group { + # fail on even numbered values, succeed on odd numbered ones + if ("%{expr:%{Foreach-Variable-0} %% 2}" == 0) { + fail + } + else { + update request { + Tmp-Integer-0 := "%{expr:%{Tmp-Integer-0} + 1}" + Filter-Id += "SUCCEED ODD %{Foreach-Variable-0} %{Tmp-Integer-0}" + } + ok + } + } + group { + # succeed on even-numbered values, fail on off-numbered ones. + if ("%{expr:%{Foreach-Variable-0} %% 2}" == 1) { + fail + } + else { + update request { + Tmp-Integer-0 := "%{expr:%{Tmp-Integer-0} + 1}" + Filter-Id += "SUCCEED EVEN %{Foreach-Variable-0} %{Tmp-Integer-0}" + } + ok + } + } + } +} + +if (&Tmp-Integer-0 != "%{Tmp-Integer-1[#]}") { + update reply { + Filter-Id += "fail 2 (passed %{Tmp-Integer-0}/%{Tmp-Integer-1[#]})" + } +} +else { + update reply { + Filter-Id := 'filter' + } +} |