Test that 'zone-statistics full;' is properly processed

This commit is contained in:
Mark Andrews 2021-07-14 09:58:50 +10:00
parent 02c3a2decc
commit 592f9ff6bc
4 changed files with 88 additions and 2 deletions

View file

@ -577,7 +577,7 @@ _repeat() (
)
rndc_reload() {
echo_i "`$RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} reload $3 2>&1 | sed 's/^/'$1' /'`"
$RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} reload $3 2>&1 | sed 's/^/'"I:$SYSTESTDIR:$1"' /'
# reloading single zone is synchronous, if we're reloading whole server
# we need to wait for reload to finish
if [ -z "$3" ]; then
@ -589,7 +589,7 @@ rndc_reload() {
}
rndc_reconfig() {
echo_i "`$RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} reconfig 2>&1 | sed 's/^/'$1' /'`"
$RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} reconfig 2>&1 | sed 's/^/'"I:$SYSTESTDIR:$1"' /'
for __try in 0 1 2 3 4 5 6 7 8 9; do
$RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} status | grep "reload/reconfig in progress" > /dev/null || break
sleep 1

View file

@ -20,6 +20,7 @@ rm -f */named.memstats
rm -f */named.run
rm -f */ans.run
rm -f */named.stats
rm -f */named.stats-stage*
rm -f dig.out*
rm -f curl.out.*
rm -f ns*/named.lock

View file

@ -0,0 +1,48 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
query-source address 10.53.0.2;
notify-source 10.53.0.2;
transfer-source 10.53.0.2;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.2; };
listen-on-v6 { none; };
recursion yes;
notify yes;
};
statistics-channels {
inet 10.53.0.2 port @EXTRAPORT1@ allow { any; };
};
key rndc_key {
secret "1234abcd8765";
algorithm hmac-sha256;
};
controls {
inet 10.53.0.2 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
zone "." {
type hint;
file "../../common/root.hint";
};
zone "example" {
type primary;
file "example.db";
allow-update { any; };
zone-statistics full;
};

View file

@ -238,5 +238,42 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "Check that 'zone-statistics full;' is processed by 'rndc reconfig' ($n)"
ret=0
# off by default
rm -f ns2/named.stats
$RNDCCMD -s 10.53.0.2 stats 2>&1 | sed 's/^/I:ns2 /'
sleep 1
cp ns2/named.stats ns2/named.stats-stage1-$n
sed -n '/Per Zone Query Statistics/,/^++/p' ns2/named.stats-stage1-$n | grep -F '[example]' > /dev/null && ret=0
# turn on
copy_setports ns2/named2.conf.in ns2/named.conf
rndc_reconfig ns2 10.53.0.2
rm -f ns2/named.stats
$RNDCCMD -s 10.53.0.2 stats 2>&1 | sed 's/^/I:ns2 /'
sleep 1
cp ns2/named.stats ns2/named.stats-stage2-$n
sed -n '/Per Zone Query Statistics/,/^++/p' ns2/named.stats-stage2-$n | grep -F '[example]' > /dev/null || ret=1
# turn off
copy_setports ns2/named.conf.in ns2/named.conf
rndc_reconfig ns2 10.53.0.2
rm -f ns2/named.stats
$RNDCCMD -s 10.53.0.2 stats 2>&1 | sed 's/^/I:ns2 /'
sleep 1
cp ns2/named.stats ns2/named.stats-stage3-$n
sed -n '/Per Zone Query Statistics/,/^++/p' ns2/named.stats-stage3-$n | grep -F '[example]' > /dev/null && ret=0
# turn on
copy_setports ns2/named2.conf.in ns2/named.conf
rndc_reconfig ns2 10.53.0.2
rm -f ns2/named.stats
$RNDCCMD -s 10.53.0.2 stats 2>&1 | sed 's/^/I:ns2 /'
sleep 1
cp ns2/named.stats ns2/named.stats-stage4-$n
sed -n '/Per Zone Query Statistics/,/^++/p' ns2/named.stats-stage4-$n | grep -F '[example]' > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1