[9.18] fix: test: The statschannel tests fails if one of libxml2 or json-c is configured

The `statschannel` system test failed if only one of `libxml2` or `json-c` is
available / configured as checks were being run against the non available
statistics page.

Closes #4919

Backport of MR !9454

Merge branch 'backport-4919-fix-statschannel-system-test-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9484
This commit is contained in:
Mark Andrews 2024-09-11 23:51:01 +00:00
commit b5aa3696c5

View file

@ -150,7 +150,7 @@ $RNDCCMD 10.53.0.2 stats 2>&1 | sed 's/^/I:ns1 /'
query_count=$(awk '/QUERY/ {print $1}' ns2/named.stats)
txt_count=$(awk '/TXT/ {print $1}' ns2/named.stats)
noerror_count=$(awk '/NOERROR/ {print $1}' ns2/named.stats)
if [ $PERL_XML ]; then
if [ "$PERL_XML" ]; then
file=$($PERL fetch.pl -p ${EXTRAPORT1} xml/v3/server)
mv $file xml.stats
$PERL server-xml.pl >xml.fmtstats 2>/dev/null
@ -164,7 +164,7 @@ if [ $PERL_XML ]; then
xml_noerror_count=${xml_noerror_count:-0}
[ "$noerror_count" -eq "$xml_noerror_count" ] || ret=1
fi
if [ $PERL_JSON ]; then
if [ "$PERL_JSON" ]; then
file=$($PERL fetch.pl -p ${EXTRAPORT1} json/v1/server)
mv $file json.stats
$PERL server-json.pl >json.fmtstats 2>/dev/null
@ -184,7 +184,7 @@ n=$((n + 1))
ret=0
echo_i "checking malloced memory statistics xml/json ($n)"
if [ $PERL_XML ]; then
if [ "$PERL_XML" ]; then
file=$($PERL fetch.pl -p ${EXTRAPORT1} xml/v3/mem)
mv $file xml.mem
$PERL mem-xml.pl $file >xml.fmtmem
@ -192,7 +192,7 @@ if [ $PERL_XML ]; then
grep "'malloced' => '[0-9][0-9]*'" xml.fmtmem >/dev/null || ret=1
grep "'maxmalloced' => '[0-9][0-9]*'" xml.fmtmem >/dev/null || ret=1
fi
if [ $PERL_JSON ]; then
if [ "$PERL_JSON" ]; then
file=$($PERL fetch.pl -p ${EXTRAPORT1} json/v1/mem)
mv $file json.mem
grep '"malloced":[0-9][0-9]*,' json.mem >/dev/null || ret=1
@ -270,11 +270,11 @@ cat zones.expect | sort >zones.expect.$n
rm -f zones.expect
# Fetch and check the dnssec sign statistics.
echo_i "fetching zone '$zone' stats data after zone maintenance at startup ($n)"
if [ $PERL_XML ]; then
if [ "$PERL_XML" ]; then
getzones xml $zone x$n || ret=1
cmp zones.out.x$n zones.expect.$n || ret=1
fi
if [ $PERL_JSON ]; then
if [ "$PERL_JSON" ]; then
getzones json 0 j$n || ret=1
cmp zones.out.j$n zones.expect.$n || ret=1
fi
@ -300,11 +300,11 @@ cat zones.expect | sort >zones.expect.$n
rm -f zones.expect
# Fetch and check the dnssec sign statistics.
echo_i "fetching zone '$zone' stats data after dynamic update ($n)"
if [ $PERL_XML ]; then
if [ "$PERL_XML" ]; then
getzones xml $zone x$n || ret=1
cmp zones.out.x$n zones.expect.$n || ret=1
fi
if [ $PERL_JSON ]; then
if [ "$PERL_JSON" ]; then
getzones json 0 j$n || ret=1
cmp zones.out.j$n zones.expect.$n || ret=1
fi
@ -327,11 +327,11 @@ echo "${sign_prefix} ${ksk_id}: 2" >>zones.expect
cat zones.expect | sort >zones.expect.$n
rm -f zones.expect
# Fetch and check the dnssec sign statistics.
if [ $PERL_XML ]; then
if [ "$PERL_XML" ]; then
getzones xml $zone x$n || ret=1
cmp zones.out.x$n zones.expect.$n || ret=1
fi
if [ $PERL_JSON ]; then
if [ "$PERL_JSON" ]; then
getzones json 0 j$n || ret=1
cmp zones.out.j$n zones.expect.$n || ret=1
fi
@ -368,11 +368,11 @@ cat zones.expect | sort >zones.expect.$n
rm -f zones.expect
# Fetch and check the dnssec sign statistics.
echo_i "fetching zone '$zone' stats data after zone maintenance at startup ($n)"
if [ $PERL_XML ]; then
if [ "$PERL_XML" ]; then
getzones xml $zone x$n || ret=1
cmp zones.out.x$n zones.expect.$n || ret=1
fi
if [ $PERL_JSON ]; then
if [ "$PERL_JSON" ]; then
getzones json 2 j$n || ret=1
cmp zones.out.j$n zones.expect.$n || ret=1
fi
@ -406,11 +406,11 @@ cat zones.expect | sort >zones.expect.$n
rm -f zones.expect
# Fetch and check the dnssec sign statistics.
echo_i "fetching zone '$zone' stats data after dynamic update ($n)"
if [ $PERL_XML ]; then
if [ "$PERL_XML" ]; then
getzones xml $zone x$n || ret=1
cmp zones.out.x$n zones.expect.$n || ret=1
fi
if [ $PERL_JSON ]; then
if [ "$PERL_JSON" ]; then
getzones json 2 j$n || ret=1
cmp zones.out.j$n zones.expect.$n || ret=1
fi
@ -435,11 +435,11 @@ cat zones.expect | sort >zones.expect.$n
rm -f zones.expect
# Fetch and check the dnssec sign statistics.
echo_i "fetching zone '$zone' stats data after dnssec-policy change ($n)"
if [ $PERL_XML ]; then
if [ "$PERL_XML" ]; then
getzones xml $zone x$n || ret=1
cmp zones.out.x$n zones.expect.$n || ret=1
fi
if [ $PERL_JSON ]; then
if [ "$PERL_JSON" ]; then
getzones json 2 j$n || ret=1
cmp zones.out.j$n zones.expect.$n || ret=1
fi