Add system tests for AXFR statistics
Ensure AXFR statistics are calculated correctly by dig and named, both for incoming and outgoing transfers. Rather than employing a zone which is already used in the "xfer" system test, create a new one whose AXFR form spans multiple TCP messages. Disable EDNS when using dig to request an AXFR so that the same reference file can be used for testing statistics calculated by both dig and named (dig uses EDNS by default when sending transfer requests, which affects the number of bytes transferred).
This commit is contained in:
3
bin/tests/system/xfer/axfr-stats.good
Normal file
3
bin/tests/system/xfer/axfr-stats.good
Normal file
@@ -0,0 +1,3 @@
|
||||
messages=16
|
||||
records=10003
|
||||
bytes=218227
|
||||
@@ -15,10 +15,11 @@
|
||||
|
||||
rm -f dig.out.*
|
||||
rm -f axfr.out
|
||||
rm -f stats.*
|
||||
rm -f ns1/slave.db ns2/slave.db
|
||||
rm -f ns1/edns-expire.db
|
||||
rm -f ns2/example.db ns2/tsigzone.db ns2/example.db.jnl
|
||||
rm -f ns3/example.bk ns3/tsigzone.bk ns3/example.bk.jnl
|
||||
rm -f ns3/example.bk ns3/xfer-stats.bk ns3/tsigzone.bk ns3/example.bk.jnl
|
||||
rm -f ns3/master.bk ns3/master.bk.jnl
|
||||
rm -f ns4/nil.db ns4/root.db
|
||||
rm -f ns6/*.db ns6/*.bk ns6/*.jnl
|
||||
|
||||
@@ -52,3 +52,8 @@ zone "ixfr-too-big" {
|
||||
allow-update { any; };
|
||||
file "ixfr-too-big.db";
|
||||
};
|
||||
|
||||
zone "xfer-stats" {
|
||||
type master;
|
||||
file "xfer-stats.db";
|
||||
};
|
||||
|
||||
13
bin/tests/system/xfer/ns1/xfer-stats.db
Normal file
13
bin/tests/system/xfer/ns1/xfer-stats.db
Normal file
@@ -0,0 +1,13 @@
|
||||
; 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 http://mozilla.org/MPL/2.0/.
|
||||
;
|
||||
; See the COPYRIGHT file distributed with this work for additional
|
||||
; information regarding copyright ownership.
|
||||
|
||||
$TTL 3600
|
||||
@ SOA . . 0 0 0 0 0
|
||||
@ NS .
|
||||
$GENERATE 1-10000 $ TXT $
|
||||
@@ -69,3 +69,9 @@ zone "mapped" {
|
||||
masterfile-format map;
|
||||
file "mapped.bk";
|
||||
};
|
||||
|
||||
zone "xfer-stats" {
|
||||
type slave;
|
||||
masters { 10.53.0.1; };
|
||||
file "xfer-stats.bk";
|
||||
};
|
||||
|
||||
@@ -464,5 +464,49 @@ grep "'ixfr-too-big/IN'.*: too many records" ns6/named.run >/dev/null || tmp=1
|
||||
if test $tmp != 0 ; then echo_i "failed"; fi
|
||||
status=`expr $status + $tmp`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "checking whether dig calculates AXFR statistics correctly"
|
||||
# Loop until the secondary server manages to transfer the "xfer-stats" zone so
|
||||
# that we can both check dig output and immediately proceed with the next test.
|
||||
# Use -b so that we can discern between incoming and outgoing transfers in ns3
|
||||
# logs later on.
|
||||
tmp=1
|
||||
for i in 1 2 3 4 5 6 7 8 9 10; do
|
||||
$DIG $DIGOPTS +noedns +stat -b 10.53.0.2 @10.53.0.3 xfer-stats. AXFR > dig.out.ns3.$n
|
||||
if grep "; Transfer failed" dig.out.ns3.$n > /dev/null; then
|
||||
sleep 1
|
||||
else
|
||||
tmp=0
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ $tmp -ne 0 ]; then
|
||||
echo_i "timed out waiting for zone transfer"
|
||||
else
|
||||
get_dig_xfer_stats dig.out.ns3.$n > stats.dig
|
||||
diff axfr-stats.good stats.dig || tmp=1
|
||||
fi
|
||||
if test $tmp != 0 ; then echo_i "failed"; fi
|
||||
status=`expr $status + $tmp`
|
||||
|
||||
# Note: in the next two tests, we use ns3 logs for checking both incoming and
|
||||
# outgoing transfer statistics as ns3 is both a secondary server (for ns1) and a
|
||||
# primary server (for dig queries from the previous test) for "xfer-stats".
|
||||
n=`expr $n + 1`
|
||||
echo_i "checking whether named calculates incoming AXFR statistics correctly"
|
||||
tmp=0
|
||||
get_named_xfer_stats ns3/named.run 10.53.0.1 xfer-stats "Transfer completed" > stats.incoming
|
||||
diff axfr-stats.good stats.incoming || tmp=1
|
||||
if test $tmp != 0 ; then echo_i "failed"; fi
|
||||
status=`expr $status + $tmp`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "checking whether named calculates outgoing AXFR statistics correctly"
|
||||
tmp=0
|
||||
get_named_xfer_stats ns3/named.run 10.53.0.2 xfer-stats "AXFR ended" > stats.outgoing
|
||||
diff axfr-stats.good stats.outgoing || tmp=1
|
||||
if test $tmp != 0 ; then echo_i "failed"; fi
|
||||
status=`expr $status + $tmp`
|
||||
|
||||
echo_i "exit status: $status"
|
||||
[ $status -eq 0 ] || exit 1
|
||||
|
||||
@@ -1161,6 +1161,7 @@
|
||||
./bin/tests/system/xfer/ans5/unknownkey X 2011,2018,2019
|
||||
./bin/tests/system/xfer/ans5/unsigned X 2011,2018,2019
|
||||
./bin/tests/system/xfer/ans5/wrongkey X 2011,2018,2019
|
||||
./bin/tests/system/xfer/axfr-stats.good X 2019
|
||||
./bin/tests/system/xfer/clean.sh SH 2000,2001,2004,2007,2011,2012,2013,2014,2015,2016,2018,2019
|
||||
./bin/tests/system/xfer/dig1.good X 2000,2001,2003,2004,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019
|
||||
./bin/tests/system/xfer/dig2.good X 2000,2001,2003,2004,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019
|
||||
|
||||
Reference in New Issue
Block a user