]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Test that 'zone-statistics full;' is properly processed
authorMark Andrews <marka@isc.org>
Tue, 13 Jul 2021 23:58:50 +0000 (09:58 +1000)
committerMark Andrews <marka@isc.org>
Fri, 16 Jul 2021 03:49:22 +0000 (13:49 +1000)
bin/tests/system/conf.sh.common
bin/tests/system/statistics/clean.sh
bin/tests/system/statistics/ns2/named2.conf.in [new file with mode: 0644]
bin/tests/system/statistics/tests.sh

index bbc6ade2eaeaa8b62d7f3792bc9d200c563c717d..f307da1eb68f9ef8362f70e126d227abc6f6a1b7 100644 (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
index 8a82a49d64d45f9078c5e9fd41110fc3d056aebb..a99e3bab973f0e6c0d828d597816a7fc1288caea 100644 (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
diff --git a/bin/tests/system/statistics/ns2/named2.conf.in b/bin/tests/system/statistics/ns2/named2.conf.in
new file mode 100644 (file)
index 0000000..7fdf303
--- /dev/null
@@ -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;
+};
index 055bd88d4a4cf3185fed6efefda05da6e46f04fb..aed7bba1d2f714553077800de76fe4e7a7bc5264 100644 (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