From 153c9d350965194bd49b6173793c48650f991f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 16 Jun 2026 12:39:56 +0200 Subject: [PATCH] Poll for RPZ readiness in the servfail-until-ready test RPZ is ready only once every policy zone has completed its first update, and the zones do not finish in a fixed order, so whenever the updates run serially (per-loop offload, or any single-CPU run): 'slow-rpz' zone can finish before the others and the query still gets SERVFAIL. Poll the query until it returns NOERROR instead. Assisted-by: Claude:claude-opus-4-8 --- bin/tests/system/rpz/tests.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/tests/system/rpz/tests.sh b/bin/tests/system/rpz/tests.sh index 2172cec705..e724b9f794 100644 --- a/bin/tests/system/rpz/tests.sh +++ b/bin/tests/system/rpz/tests.sh @@ -857,11 +857,16 @@ grep "status: SERVFAIL" dig.out.${t} >/dev/null || setret "failed" t=$((t + 1)) echo_i "checking that 'servfail-until-ready yes' works (part 2) (${t})" -# The 'slow-rpz.' zone has 30 records (RPZ rules), and '-T rpzslow' forces a -# 100ms delay for each rule. Wait enough time for processing to finish. -wait_for_log 10 "slow-rpz: reload done" ns3/named.run -# Now the same request as in the previous test should return NOERROR -$DIG tld2. NS -p ${PORT} @$ns3 >dig.out.${t} || setret "failed" -grep "status: NOERROR" dig.out.${t} >/dev/null || setret "failed" +# RPZ becomes ready only after *all* policy zones have finished their initial +# update, and the zones do not finish in a fixed order. The 'slow-rpz' zone (30 +# rules, each delayed 100ms by '-T rpzslow') only keeps RPZ busy long enough for +# part 1 above; it is not necessarily the last zone to finish, so its "reload +# done" log line does not mean RPZ is ready. Poll the query until it returns +# NOERROR instead. +_servfail_until_ready() { + $DIG tld2. NS -p ${PORT} @$ns3 >dig.out.${t} \ + && grep "status: NOERROR" dig.out.${t} >/dev/null +} +retry_quiet 20 _servfail_until_ready || setret "failed" [ $status -eq 0 ] || exit 1