From 8f617d79719d295fe78211df9d19c478bc3fd219 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Thu, 12 Sep 2024 12:17:28 +0000 Subject: [PATCH] Add a statistics channel check in the forward system test Check that the fix in the previous commit works and that the 'ServerQuota' counter in the statistics channel is still unset after a SERVFAIL result in a 'forward only' zone. (cherry picked from commit 81b3c5d90821d14ee11bbdb68ccfa7319147d4ca) --- bin/tests/system/forward/clean.sh | 1 + bin/tests/system/forward/ns4/named.conf.in | 2 ++ bin/tests/system/forward/tests.sh | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/bin/tests/system/forward/clean.sh b/bin/tests/system/forward/clean.sh index 6d76bb013c..8473402a13 100644 --- a/bin/tests/system/forward/clean.sh +++ b/bin/tests/system/forward/clean.sh @@ -14,6 +14,7 @@ # # Clean up after forward tests. # +rm -f ./statschannel.out.* rm -f ./dig.out.* rm -f ./*/named.conf rm -f ./*/named.memstats diff --git a/bin/tests/system/forward/ns4/named.conf.in b/bin/tests/system/forward/ns4/named.conf.in index c97823dee0..800b9831a7 100644 --- a/bin/tests/system/forward/ns4/named.conf.in +++ b/bin/tests/system/forward/ns4/named.conf.in @@ -24,6 +24,8 @@ options { minimal-responses yes; }; +statistics-channels { inet 10.53.0.4 port @EXTRAPORT1@ allow { localhost; }; }; + zone "." { type hint; file "root.db"; diff --git a/bin/tests/system/forward/tests.sh b/bin/tests/system/forward/tests.sh index b9426997cc..4304dab277 100644 --- a/bin/tests/system/forward/tests.sh +++ b/bin/tests/system/forward/tests.sh @@ -107,6 +107,15 @@ grep "SERVFAIL" dig.out.$n.f2 >/dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) +# GL#1793 +n=$((n + 1)) +echo_i "checking that the 'serverquota' counter isn't 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 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status + ret)) + n=$((n + 1)) echo_i "checking for negative caching of forwarder response ($n)" # prime the cache, shutdown the forwarder then check that we can