From 2a4355331a0b6f240bf6f1b26fd540af48d33983 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Wed, 8 Oct 2025 20:13:58 +0200 Subject: [PATCH] Fix forward ns4 when statistics-channels is disabled With statistics-channels disabled, ns4 fails to start with: option 'statistics-channels' was not enabled at compile time --- bin/tests/system/forward/ns4/named.conf.j2 | 2 ++ bin/tests/system/forward/tests.sh | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/tests/system/forward/ns4/named.conf.j2 b/bin/tests/system/forward/ns4/named.conf.j2 index 5a12eef685..8e3e05136e 100644 --- a/bin/tests/system/forward/ns4/named.conf.j2 +++ b/bin/tests/system/forward/ns4/named.conf.j2 @@ -33,7 +33,9 @@ options { }; +{% if FEATURE_JSON_C == "1" %} statistics-channels { inet 10.53.0.4 port @EXTRAPORT1@ allow { localhost; }; }; +{% endif %} zone "." { type hint; diff --git a/bin/tests/system/forward/tests.sh b/bin/tests/system/forward/tests.sh index 024e21c3c7..a1d7ad154d 100644 --- a/bin/tests/system/forward/tests.sh +++ b/bin/tests/system/forward/tests.sh @@ -170,12 +170,16 @@ status=$((status + ret)) # GL#1793 n=$((n + 1)) echo_i "checking that the correct counter is increased because of the SERVFAIL in the previous check ($n)" -ret=0 -"${CURL}" "http://10.53.0.4:${EXTRAPORT1}/json/v1" 2>/dev/null >statschannel.out.$n -grep -F '"ServerQuota"' statschannel.out.$n >/dev/null && ret=1 -grep -F '"ForwardOnlyFail":1' statschannel.out.$n >/dev/null || ret=1 -if [ $ret != 0 ]; then echo_i "failed"; fi -status=$((status + ret)) +if $FEATURETEST --have-json-c && [ -x ${CURL} ]; then + ret=0 + "${CURL}" "http://10.53.0.4:${EXTRAPORT1}/json/v1" 2>/dev/null >statschannel.out.$n + grep -F '"ServerQuota"' statschannel.out.$n >/dev/null && ret=1 + grep -F '"ForwardOnlyFail":1' statschannel.out.$n >/dev/null || ret=1 + if [ $ret != 0 ]; then echo_i "failed"; fi + status=$((status + ret)) +else + echo_i "skipping test as libjson-c and/or curl was not found" +fi n=$((n + 1)) echo_i "checking for negative caching of forwarder response ($n)"