Skip to content

Commit 68abae5

Browse files
committed
Merge branch 'loadgen-5hs-tests' into multi-server-tests
2 parents e5c3ba3 + e221931 commit 68abae5

1 file changed

Lines changed: 81 additions & 6 deletions

File tree

.github/workflows/ci-multi-server-tests.yml

Lines changed: 81 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ jobs:
2121
steps:
2222
- run: echo "Pre-test job; checking if using self-hosted runners"
2323

24+
# Job only runs on GitHub-hosted runners
2425
test-5hs-autoaccept:
2526
needs: pre-test
26-
runs-on: ${{ needs.pre-test.outputs.selfhosted == '1' && 'self-hosted' || 'ubuntu-24.04' }}
27+
runs-on: ubuntu-24.04
28+
if: ${{ needs.pre-test.outputs.selfhosted != '1' }}
2729

2830
env:
2931
MULTI_SERVER_ENV_DOCKER_BUILD_OS: ubuntu24
@@ -71,7 +73,6 @@ jobs:
7173
sudo mk-build-deps -irt"apt-get -y --no-install-recommends" scripts/ci/extra-packages.debian.control
7274
7375
- name: Build Docker image for multi-server test environment
74-
if: ${{ needs.pre-test.outputs.selfhosted != '1' }}
7576
run: |
7677
./configure
7778
make docker.${MULTI_SERVER_ENV_DOCKER_BUILD_OS}.build
@@ -82,16 +83,90 @@ jobs:
8283
# Tag freeradius build image using using a non-OS specific name to be used with the multi-server docker compose environment.
8384
docker tag freeradius4/${MULTI_SERVER_ENV_DOCKER_BUILD_OS}:latest freeradius-build:latest
8485
86+
- name: Run test-5hs-autoaccept test
87+
run: |
88+
if ! docker images --format '{{.Repository}}:{{.Tag}}' | grep -q "^freeradius-build:latest$"; then
89+
echo "Error: freeradius-build:latest Docker image not found and required for multi-server test environment."
90+
exit 1
91+
fi
92+
make -f src/tests/multi-server/all.mk test-5hs-autoaccept
93+
94+
- name: Verify test results
95+
shell: bash
96+
run: |
97+
set -euo pipefail
98+
99+
echo "============ ${MULTI_SERVER_TEST_LOG} ============"
100+
cat "${MULTI_SERVER_TEST_LOG}"
101+
102+
if grep -q '\[Failed\]' "${MULTI_SERVER_TEST_LOG}"; then
103+
echo "TEST FAILED: Found [Failed] in log"
104+
grep '\[Failed\]' "${MULTI_SERVER_TEST_LOG}"
105+
exit 1
106+
fi
107+
108+
if grep -Eq '\(Failures:[[:space:]]*[1-9][0-9]*[[:space:]]*\)' "${MULTI_SERVER_TEST_LOG}"; then
109+
echo "TEST FAILED: Found Failures > 0 in log"
110+
grep -E '\(Failures:[[:space:]]*[1-9][0-9]*[[:space:]]*\)' "${MULTI_SERVER_TEST_LOG}"
111+
exit 1
112+
fi
113+
114+
log="${MULTI_SERVER_TEST_LOG}"
115+
if awk '
116+
BEGIN { found=0; n1=0; n2=0; line="" }
117+
index($0,"Matched:") {
118+
orig=$0
119+
s=$0
120+
gsub(/[[:space:]]/, "", s)
121+
sub(/^.*Matched:/, "", s)
122+
sub(/\(.*/, "", s)
123+
n = split(s, parts, "/")
124+
if (n == 2) {
125+
a = parts[1] + 0
126+
b = parts[2] + 0
127+
if (a > 0 && a == b) { found=1; n1=a; n2=b; line=orig }
128+
}
129+
}
130+
END {
131+
if (found) { printf "MATCH: %d / %d\nMatched line: %s\n", n1, n2, line; exit 0 }
132+
exit 1
133+
}
134+
' "$log"
135+
then
136+
: # PASS
137+
else
138+
echo "TEST FAILED: No Matched line found with equal non-zero counts"
139+
exit 1
140+
fi
141+
142+
# Job only runs on self-hosted runners
143+
test-5hs-autoaccept-selfhosted:
144+
needs: pre-test
145+
runs-on: self-hosted
146+
if: ${{ needs.pre-test.outputs.selfhosted == '1' }}
147+
148+
env:
149+
MULTI_SERVER_TEST_LOG: build/tests/multi-server/freeradius-multi-server/multi_server_test.log
150+
151+
steps:
152+
153+
# Need git installed for checkout to behave normally
154+
- name: Install checkout prerequisites
155+
run: apt-get update && apt-get install -y --no-install-recommends git git-lfs ca-certificates
156+
157+
# Checkout, but defer pulling LFS objects until we've restored the cache
158+
- uses: actions/checkout@v4
159+
with:
160+
lfs: false
161+
85162
- name: Get pre-built Docker image for self-hosted runner test
86-
if: ${{ needs.pre-test.outputs.selfhosted == '1' }}
87163
run: |
88-
docker pull docker.internal.networkradius.com/self-hosted
164+
docker pull docker.internal.networkradius.com/self-hosted-ubuntu24
89165
90166
# Tag freeradius build image using using a non-OS specific name to be used with the multi-server docker compose environment.
91-
docker tag docker.internal.networkradius.com/self-hosted freeradius-build:latest
167+
docker tag docker.internal.networkradius.com/self-hosted-ubuntu24 freeradius-build:latest
92168
93169
- name: Run test-5hs-autoaccept test
94-
if: ${{ needs.pre-test.outputs.selfhosted != '1' }}
95170
run: |
96171
if ! docker images --format '{{.Repository}}:{{.Tag}}' | grep -q "^freeradius-build:latest$"; then
97172
echo "Error: freeradius-build:latest Docker image not found and required for multi-server test environment."

0 commit comments

Comments
 (0)