From a9a47c79e93ef7c91e99a7b1e60cc306abbc85c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Thu, 31 Jan 2019 15:43:58 +0100 Subject: [PATCH] Add system tests for IXFR statistics Ensure IXFR statistics are calculated correctly by dig and named, both for incoming and outgoing transfers. Disable EDNS when using dig to request an IXFR 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). --- bin/tests/system/ixfr/clean.sh | 3 ++- bin/tests/system/ixfr/ixfr-stats.good | 3 +++ bin/tests/system/ixfr/tests.sh | 25 +++++++++++++++++++++++++ util/copyrights | 1 + 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 bin/tests/system/ixfr/ixfr-stats.good diff --git a/bin/tests/system/ixfr/clean.sh b/bin/tests/system/ixfr/clean.sh index d75c36e4eb..fe05b404de 100644 --- a/bin/tests/system/ixfr/clean.sh +++ b/bin/tests/system/ixfr/clean.sh @@ -9,6 +9,7 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. +rm -f stats.* rm -f ns1/myftp.db rm -f ns3/*.jnl ns3/mytest.db ns3/subtest.db rm -f ns4/*.jnl ns4/*.db @@ -19,4 +20,4 @@ rm -f */ans.run rm -f dig.out dig.out1 dig.out2 dig.out3 rm -f ns3/large.db rm -f ns*/named.lock -rm -f ns*/managed-keys.bind* +rm -f ns*/managed-keys.bind* ns*/*.mkeys diff --git a/bin/tests/system/ixfr/ixfr-stats.good b/bin/tests/system/ixfr/ixfr-stats.good new file mode 100644 index 0000000000..dd62e121d6 --- /dev/null +++ b/bin/tests/system/ixfr/ixfr-stats.good @@ -0,0 +1,3 @@ +messages=1 +records=6 +bytes=219 diff --git a/bin/tests/system/ixfr/tests.sh b/bin/tests/system/ixfr/tests.sh index d023eef302..64d11a8529 100644 --- a/bin/tests/system/ixfr/tests.sh +++ b/bin/tests/system/ixfr/tests.sh @@ -307,5 +307,30 @@ if [ ${ret} != 0 ]; then status=1; fi +echo_i "checking whether dig calculates IXFR statistics correctly" +ret=0 +$DIG $DIGOPTS +noedns +stat -b 10.53.0.4 @10.53.0.4 test. ixfr=2 > dig.out1 +get_dig_xfer_stats dig.out1 > stats.dig +diff ixfr-stats.good stats.dig || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=`expr $status + $ret` + +# Note: in the next two tests, we use ns4 logs for checking both incoming and +# outgoing transfer statistics as ns4 is both a secondary server (for ns3) and a +# primary server (for dig queries from the previous test) for "test". +echo_i "checking whether named calculates incoming IXFR statistics correctly" +ret=0 +get_named_xfer_stats ns4/named.run 10.53.0.3 test "Transfer completed" > stats.incoming +diff ixfr-stats.good stats.incoming || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=`expr $status + $ret` + +echo_i "checking whether named calculates outgoing IXFR statistics correctly" +ret=0 +get_named_xfer_stats ns4/named.run 10.53.0.4 test "IXFR ended" > stats.outgoing +diff ixfr-stats.good stats.outgoing || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=`expr $status + $ret` + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 diff --git a/util/copyrights b/util/copyrights index 1881953c18..a9ac4f82a4 100644 --- a/util/copyrights +++ b/util/copyrights @@ -702,6 +702,7 @@ ./bin/tests/system/integrity/tests.sh SH 2017,2018,2019 ./bin/tests/system/ixfr/ans2/startme X 2011,2018,2019 ./bin/tests/system/ixfr/clean.sh SH 2001,2004,2007,2011,2012,2014,2015,2016,2018,2019 +./bin/tests/system/ixfr/ixfr-stats.good X 2019 ./bin/tests/system/ixfr/ns1/startme X 2012,2013,2018,2019 ./bin/tests/system/ixfr/prereq.sh SH 2001,2004,2007,2012,2014,2016,2018,2019 ./bin/tests/system/ixfr/setup.sh SH 2001,2004,2007,2011,2012,2013,2014,2016,2018,2019