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:
Michał Kępień
2019-01-31 15:43:58 +01:00
committed by Evan Hunt
parent 6071c6cc27
commit a22e24a411
7 changed files with 74 additions and 1 deletions

View File

@@ -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