]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add a system test for AXFR fallback when max-ixfr-ratio is exceeded
authorEvan Hunt <each@isc.org>
Sat, 22 Feb 2020 06:48:34 +0000 (22:48 -0800)
committerEvan Hunt <each@isc.org>
Fri, 6 Mar 2020 01:20:16 +0000 (17:20 -0800)
also cleaned up the ixfr system test:

- use retry_quiet when applicable
- use scripts to generate test zones
- improve consistency

14 files changed:
bin/tests/system/ixfr/clean.sh
bin/tests/system/ixfr/ixfr-stats.good
bin/tests/system/ixfr/ns1/.gitignore [deleted file]
bin/tests/system/ixfr/ns1/named.conf.in [new file with mode: 0644]
bin/tests/system/ixfr/ns1/startme [deleted file]
bin/tests/system/ixfr/ns3/mytest0.db [deleted file]
bin/tests/system/ixfr/ns3/mytest1.db [deleted file]
bin/tests/system/ixfr/ns3/mytest2.db [deleted file]
bin/tests/system/ixfr/ns3/named.conf.in
bin/tests/system/ixfr/ns3/subtest0.db [deleted file]
bin/tests/system/ixfr/ns3/subtest1.db [deleted file]
bin/tests/system/ixfr/setup.sh
bin/tests/system/ixfr/tests.sh
util/copyrights

index 1117710c494fc18ff0dcbdea2091c3d0833a7f49..537f97fd649b8d66cc00d23ca2463236327e25c5 100644 (file)
 
 rm -f stats.*
 rm -f ns1/*.db ns1/*.jnl
-rm -f ns3/*.jnl ns3/mytest.db ns3/subtest.db
+rm -f ns3/*.jnl ns3/mytest*.db ns3/subtest*.db
 rm -f ns4/*.jnl ns4/*.db
 rm -f ns5/*.jnl ns5/*.db
 rm -f */named.memstats
 rm -f */named.conf
-rm -f */named.run
+rm -f */named.run */named.run.prev
 rm -f */ans.run
 rm -f dig.out.test* dig.out1.test* dig.out2.test* dig.out3.test*
 rm -f ns3/large.db
index dd62e121d6c62aa1bcb1d29f5033fc19c313ba3b..3d0d2dde32eb6a5bb1da0d7e945ca75a0b7d3b5d 100644 (file)
@@ -1,3 +1,3 @@
 messages=1
-records=6
-bytes=219
+records=5
+bytes=204
diff --git a/bin/tests/system/ixfr/ns1/.gitignore b/bin/tests/system/ixfr/ns1/.gitignore
deleted file mode 100644 (file)
index 58e5c92..0000000
+++ /dev/null
@@ -1 +0,0 @@
-named.conf
diff --git a/bin/tests/system/ixfr/ns1/named.conf.in b/bin/tests/system/ixfr/ns1/named.conf.in
new file mode 100644 (file)
index 0000000..854d04d
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+options {
+       query-source address 10.53.0.1;
+       notify-source 10.53.0.1;
+       transfer-source 10.53.0.1;
+       port @PORT@;
+       pid-file "named.pid";
+       listen-on { 10.53.0.1; };
+       listen-on-v6 { none; };
+       recursion no;
+       notify yes;
+};
+
+key rndc_key {
+       secret "1234abcd8765";
+       algorithm hmac-sha256;
+};
+
+controls {
+       inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
+};
diff --git a/bin/tests/system/ixfr/ns1/startme b/bin/tests/system/ixfr/ns1/startme
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/bin/tests/system/ixfr/ns3/mytest0.db b/bin/tests/system/ixfr/ns3/mytest0.db
deleted file mode 100644 (file)
index 644086f..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-; 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.
-
-$ORIGIN test.
-$TTL    15
-test.  15  IN        SOA ns1.test.  hostmaster.test. (
-                              1 ; serial
-                              3H ; refresh
-                              15 ; retry
-                              1w ; expire
-                              3h ; minimum
-                             )
-       IN  NS     ns1.test.
-       IN  NS     ns2.test.
-       IN  NS     ns5.test.
-ns1    IN  A      10.53.0.3
-ns2    IN  A      10.53.0.4
-ns5    IN  A      10.53.0.5
-host1  IN  A      192.168.10.3
-host2  IN  A      192.168.10.4
diff --git a/bin/tests/system/ixfr/ns3/mytest1.db b/bin/tests/system/ixfr/ns3/mytest1.db
deleted file mode 100644 (file)
index ddc7e05..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-; 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.
-
-$ORIGIN test.
-$TTL    15
-test.  15  IN        SOA ns1.test.  hostmaster.test. (
-                              2 ; serial
-                              3H ; refresh
-                              15 ; retry
-                              1w ; expire
-                              3h ; minimum
-                             )
-       IN  NS     ns1.test.
-       IN  NS     ns2.test.
-       IN  NS     ns5.test.
-ns1    IN  A      10.53.0.3
-ns2    IN  A      10.53.0.4
-ns5    IN  A      10.53.0.5
-host1  IN  A      192.168.10.13
-host2  IN  A      192.168.10.4
diff --git a/bin/tests/system/ixfr/ns3/mytest2.db b/bin/tests/system/ixfr/ns3/mytest2.db
deleted file mode 100644 (file)
index 080f335..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-; 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.
-
-$ORIGIN test.
-$TTL    15
-test.  15  IN        SOA ns1.test.  hostmaster.test. (
-                              4 ; serial
-                              3H ; refresh
-                              15 ; retry
-                              1w ; expire
-                              3h ; minimum
-                             )
-       IN  NS     ns1.test.
-       IN  NS     ns2.test.
-       IN  NS     ns5.test.
-ns1    IN  A      10.53.0.3
-ns2    IN  A      10.53.0.4
-ns5    IN  A      10.53.0.5
-host1  IN  A      192.168.10.13
-host2  IN  A      192.168.10.14
index 4ffb872b8fbbfcdbb6f97f0c8873dead68a93c87..fe1f7567f63e32e2c1cf5f0fed707be8c68e7c47 100644 (file)
@@ -37,6 +37,7 @@ view "primary" {
        zone "test" IN {
                type master;
                file "mytest.db";
+               max-ixfr-ratio 75%;
        };
        zone "sub.test" IN {
                type master;
diff --git a/bin/tests/system/ixfr/ns3/subtest0.db b/bin/tests/system/ixfr/ns3/subtest0.db
deleted file mode 100644 (file)
index 7dc1ed7..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-; 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.
-
-$ORIGIN sub.test.
-$TTL    15
-sub.test.  15  IN        SOA ns1.test.  hostmaster.test. (
-                              1 ; serial
-                              3H ; refresh
-                              15 ; retry
-                              1w ; expire
-                              3h ; minimum
-                             )
-       IN  NS     ns1.test.
-       IN  NS     ns2.test.
-host3  IN  A      192.168.10.23
-host4  IN  A      192.168.10.24
diff --git a/bin/tests/system/ixfr/ns3/subtest1.db b/bin/tests/system/ixfr/ns3/subtest1.db
deleted file mode 100644 (file)
index 5af027a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-; 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.
-
-$ORIGIN sub.test.
-$TTL    15
-sub.test.  15  IN        SOA ns1.test.  hostmaster.test. (
-                              3 ; serial
-                              3H ; refresh
-                              15 ; retry
-                              1w ; expire
-                              3h ; minimum
-                             )
-       IN  NS     ns1.test.
-       IN  NS     ns2.test.
-host3  IN  A      192.168.10.123
-host4  IN  A      192.168.10.24
index 963d54c50cc489411358d66ede92c4f4e355594e..8c8c5fccc73b22826ddfb0b174a373d64f5dde23 100644 (file)
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
 
-cat <<EOF >ns1/named.conf
-options {
-       query-source address 10.53.0.1;
-       notify-source 10.53.0.1;
-       transfer-source 10.53.0.1;
-       port ${PORT};
-       pid-file "named.pid";
-       listen-on { 10.53.0.1; };
-       listen-on-v6 { none; };
-       recursion no;
-       notify yes;
-};
-
-key rndc_key {
-       secret "1234abcd8765";
-       algorithm hmac-sha256;
-};
-
-controls {
-       inet 10.53.0.1 port ${CONTROLPORT} allow { any; } keys { rndc_key; };
-};
-EOF
+$SHELL clean.sh
 
+copy_setports ns1/named.conf.in ns1/named.conf
 copy_setports ns3/named.conf.in ns3/named.conf
 copy_setports ns4/named.conf.in ns4/named.conf
 copy_setports ns5/named.conf.in ns5/named.conf
 
-# Setup initial db files for ns3
-cp ns3/mytest0.db ns3/mytest.db
-cp ns3/subtest0.db ns3/subtest.db
+# Set up db files for zone "test" - this is a series of four
+# versions of the zone, the second and third having small changes
+# and the fourth having a large one.
+
+testdb () {
+    cat << EOF
+\$ORIGIN $1
+\$TTL    15
+@  15  IN        SOA ns1.test. hostmaster.test. (
+                              $2 ; serial
+                              3H ; refresh
+                              15 ; retry
+                              1w ; expire
+                              3h ; minimum
+                             )
+       IN  NS     ns1.test.
+       IN  NS     ns2.test.
+       IN  NS     ns5.test.
+ns1    IN  A      10.53.0.3
+ns2    IN  A      10.53.0.4
+ns5    IN  A      10.53.0.5
+EOF
+
+    i=0
+    while [ $i -lt $3 ]; do
+        echo "host$i IN A 192.0.2.$i"
+        i=$((i+1))
+    done
+}
+
+testdb test. 1 60 > ns3/mytest.db
+testdb test. 2 61 > ns3/mytest1.db
+testdb test. 3 62 > ns3/mytest2.db
+testdb test. 4 0  > ns3/mytest3.db
+
+# Set up similar db files for sub.test, which will have IXFR disabled
+testdb sub.test. 1 60 > ns3/subtest.db
+testdb sub.test. 3 61 > ns3/subtest1.db
+
+# Set up a large zone
+i=0
 $SHELL ../genzone.sh 3 > ns3/large.db
-awk 'END { for (i = 0; i < 10000; i++) printf("record%d 10 IN TXT this is record %d\n", i, i) }' < /dev/null >> ns3/large.db
+while [ $i -lt 10000 ]; do
+    echo "record$i 10 IN TXT this is record %i" >> ns3/large.db
+    i=$((i+1))
+done
index c07251d4d0aa74ea62ccf7d24e9e40e1aa313e37..6d1fe1f2d1b0e4ba9fb81fbfc879bdc2cda49a02 100644 (file)
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
 
+wait_for_serial() (
+    $DIG $DIGOPTS "@$1" "$2" SOA > "$4"
+    serial=$(awk '$4 == "SOA" { print $7 }' "$4")
+    [ "$3" -eq "${serial:--1}" ]
+)
+
 status=0
 n=0
 
@@ -27,6 +33,7 @@ RNDCCMD="$RNDC -p ${CONTROLPORT} -c ../common/rndc.conf -s"
 
 n=$((n+1))
 echo_i "testing initial AXFR ($n)"
+ret=0
 
 $SENDCMD <<EOF
 /SOA/
@@ -58,20 +65,15 @@ EOF
 
 rndc_reload ns1 10.53.0.1
 
-for i in 0 1 2 3 4 5 6 7 8 9
-do
-       $DIG $DIGOPTS @10.53.0.1 nil. SOA > dig.out.test$n
-       grep "SOA" dig.out.test$n > /dev/null && break
-       sleep 1
-done
+retry_quiet 10 wait_for_serial 10.53.0.1 nil. 1 dig.out.test$n || ret=1
 
-$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'initial AXFR' >/dev/null || {
-    echo_i "failed"
-    status=1
-}
+$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'initial AXFR' >/dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
 
 n=$((n+1))
 echo_i "testing successful IXFR ($n)"
+ret=0
 
 # We change the IP address of a.nil., and the TXT record at the apex.
 # Then we do a SOA-only update.
@@ -94,17 +96,17 @@ EOF
 
 sleep 1
 
-$RNDCCMD 10.53.0.1 refresh nil
+$RNDCCMD 10.53.0.1 refresh nil | sed 's/^/ns1 /' | cat_i
 
 sleep 2
 
-$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'successful IXFR' >/dev/null || {
-    echo_i "failed"
-    status=1
-}
+$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'successful IXFR' >/dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
 
 n=$((n+1))
 echo_i "testing AXFR fallback after IXFR failure ($n)"
+ret=0
 
 # Provide a broken IXFR response and a working fallback AXFR response
 
@@ -129,14 +131,13 @@ EOF
 
 sleep 1
 
-$RNDCCMD 10.53.0.1 refresh nil
+$RNDCCMD 10.53.0.1 refresh nil | sed 's/^/ns1 /' | cat_i
 
 sleep 2
 
-$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'fallback AXFR' >/dev/null || {
-    echo_i "failed"
-    status=1
-}
+$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'fallback AXFR' >/dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
 
 n=$((n+1))
 echo_i "testing ixfr-from-differences option ($n)"
@@ -146,150 +147,84 @@ if [ $? -ne 0 ]
 then
     echo_i "named-checkzone returned failure on ns3/mytest.db"
 fi
-# modify the master
-#echo_i "digging against master: "
-#$DIG $DIGOPTS @10.53.0.3 a host1.test.
-#echo_i "digging against slave: "
-#$DIG $DIGOPTS @10.53.0.4 a host1.test.
-
-# wait for slave to be stable
-for i in 0 1 2 3 4 5 6 7 8 9
-do
-       $DIG $DIGOPTS +tcp @10.53.0.4 SOA test > dig.out.test$n
-       grep -i "hostmaster\.test\..1" dig.out.test$n > /dev/null && break
-       sleep 1
-done
+
+retry_quiet 10 wait_for_serial 10.53.0.4 test. 1 dig.out.test$n || ret=1
+
+nextpart ns4/named.run > /dev/null
 
 # modify the master
 cp ns3/mytest1.db ns3/mytest.db
 $RNDCCMD 10.53.0.3 reload | sed 's/^/ns3 /' | cat_i
 
-#wait for master to reload load
-for i in 0 1 2 3 4 5 6 7 8 9
-do
-       $DIG $DIGOPTS +tcp @10.53.0.3 SOA test > dig.out.test$n
-       grep -i "hostmaster\.test\..2" dig.out.test$n > /dev/null && break
-       sleep 1
-done
-
-#wait for slave to transfer zone
-for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
-do
-       $DIG $DIGOPTS +tcp @10.53.0.4 SOA test > dig.out.test$n
-       grep -i "hostmaster\.test\..2" dig.out.test$n > /dev/null && break
-
-       # re-notify if we've been waiting a long time
-       if [ $i -ge 5 ]; then
-           $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i
-       fi
-       sleep 1
-done
-
-# slave should have gotten notify and updated
-
-for i in 0 1 2 3 4 5 6 7 8 9
-do
-       INCR=`grep "test/IN/primary" ns4/named.run|grep "got incremental"|wc -l`
-       [ $INCR -eq 1 ] && break
-       sleep 1
-done
-if [ $INCR -ne 1 ]
-then
-    echo_i "failed to get incremental response"
-    status=1
+# wait for master to reload
+retry_quiet 10 wait_for_serial 10.53.0.3 test. 2 dig.out.test$n || ret=1
+
+# wait for slave to reload
+tret=0
+retry_quiet 5 wait_for_serial 10.53.0.4 test. 2 dig.out.test$n || tret=1
+if [ $tret -eq 1 ]; then
+    # re-noitfy after 5 seconds, then wait another 10
+    $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i
+    retry_quiet 10 wait_for_serial 10.53.0.4 test. 2 dig.out.test$n || ret=1
 fi
 
+wait_for_log 10 'got incremental' ns4/named.run || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
 n=$((n+1))
-echo_i "testing request-ixfr option in view vs zone ($n)"
+echo_i "testing 'request-ixfr no' option inheritance from view ($n)"
+ret=0
 # There's a view with 2 zones. In the view, "request-ixfr yes"
 # but in the zone "sub.test", request-ixfr no"
 # we want to make sure that a change to sub.test results in AXFR, while
 # changes to test. result in IXFR
 
-echo_ic "this result should be AXFR"
 cp ns3/subtest1.db ns3/subtest.db # change to sub.test zone, should be AXFR
+nextpart ns4/named.run > /dev/null
 $RNDCCMD 10.53.0.3 reload | sed 's/^/ns3 /' | cat_i
 
-#wait for master to reload zone
-for i in 0 1 2 3 4 5 6 7 8 9
-do
-       $DIG $DIGOPTS +tcp @10.53.0.3 SOA sub.test > dig.out.test$n
-       grep -i "hostmaster\.test\..3" dig.out.test$n > /dev/null && break
-       sleep 1
-done
-
-#wait for slave to transfer zone
-for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
-do
-       $DIG $DIGOPTS +tcp @10.53.0.4 SOA sub.test > dig.out.test$n
-       grep -i "hostmaster\.test\..3" dig.out.test$n > /dev/null && break
-
-       # re-notify if we've been waiting a long time
-       if [ $i -ge 5 ]; then
-           $RNDCCMD 10.53.0.3 notify sub.test | set 's/^/ns3 /' | cat_i
-       fi
-       sleep 1
-done
-
-echo_ic "this result should be AXFR"
-for i in 0 1 2 3 4 5 6 7 8 9
-do
-       NONINCR=`grep 'sub\.test/IN/primary' ns4/named.run|grep "got nonincremental" | wc -l`
-       [ $NONINCR -eq 2 ] && break
-       sleep 1
-done
-if [ $NONINCR -ne 2 ]
-then
-    echo_ic "failed to get nonincremental response in 2nd AXFR test"
+# wait for master to reload
+retry_quiet 10 wait_for_serial 10.53.0.3 sub.test. 3 dig.out.test$n || ret=1
 
-    echo_i "failed"
-    status=1
-else
-    echo_ic "success: AXFR it was"
+# wait for slave to reload
+tret=0
+retry_quiet 5 wait_for_serial 10.53.0.4 sub.test. 3 dig.out.test$n || tret=1
+if [ $tret -eq 1 ]; then
+    # re-noitfy after 5 seconds, then wait another 10
+    $RNDCCMD 10.53.0.3 notify sub.test | set 's/^/ns3 /' | cat_i
+    retry_quiet 10 wait_for_serial 10.53.0.4 sub.test. 3 dig.out.test$n || ret=1
 fi
 
-echo_ic "this result should be IXFR"
+wait_for_log 10 'got nonincremental response' ns4/named.run || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
+n=$((n+1))
+echo_i "testing 'request-ixfr yes' option inheritance from view ($n)"
+ret=0
 cp ns3/mytest2.db ns3/mytest.db # change to test zone, should be IXFR
+nextpart ns4/named.run > /dev/null
 $RNDCCMD 10.53.0.3 reload | sed 's/^/ns3 /' | cat_i
 
-# wait for master to reload zone
-for i in 0 1 2 3 4 5 6 7 8 9
-do
-       $DIG +tcp -p 5300 @10.53.0.3 SOA test > dig.out.test$n
-       grep -i "hostmaster\.test\..4" dig.out.test$n > /dev/null && break
-       sleep 1
-done
-
-# wait for slave to transfer zone
-for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
-do
-       $DIG $DIGOPTS +tcp @10.53.0.4 SOA test > dig.out.test$n
-       grep -i "hostmaster\.test\..4" dig.out.test$n > /dev/null && break
-
-       # re-notify if we've been waiting a long time
-       if [ $i -ge 5 ]; then
-           $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i
-       fi
-       sleep 1
-done
-
-for i in 0 1 2 3 4 5 6 7 8 9
-do
-       INCR=`grep "test/IN/primary" ns4/named.run|grep "got incremental"|wc -l`
-       [ $INCR -eq 2 ] && break
-       sleep 1
-done
-if [ $INCR -ne 2 ]
-then
-    echo_ic "failed to get incremental response in 2nd IXFR test"
+# wait for master to reload
+retry_quiet 10 wait_for_serial 10.53.0.3 test. 3 dig.out.test$n || ret=1
 
-    echo_i "failed"
-    status=1
-else
-    echo_ic "success: IXFR it was"
+# wait for slave to reload
+tret=0
+retry_quiet 5 wait_for_serial 10.53.0.4 test. 3 dig.out.test$n || tret=1
+if [ $tret -eq 1 ]; then
+    # re-noitfy after 5 seconds, then wait another 10
+    $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i
+    retry_quiet 10 wait_for_serial 10.53.0.4 test. 3 dig.out.test$n || ret=1
 fi
 
+wait_for_log 10 'got incremental response' ns4/named.run || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
 n=$((n+1))
+ret=0
 echo_i "testing DiG's handling of a multi message AXFR style IXFR response ($n)"
 (
 (sleep 10 && kill $$) 2>/dev/null &
@@ -298,9 +233,11 @@ $DIG -p ${PORT} ixfr=0 large @10.53.0.3 > dig.out.test$n
 kill $sub
 )
 lines=`grep hostmaster.large dig.out.test$n | wc -l`
-test ${lines:-0} -eq 2 || { echo_i "failed"; status=1; }
+test ${lines:-0} -eq 2 || ret=1
 messages=`sed -n 's/^;;.*messages \([0-9]*\),.*/\1/p' dig.out.test$n`
-test ${messages:-0} -gt 1 || { echo_i "failed"; status=1; }
+test ${messages:-0} -gt 1 || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
 
 n=$((n+1))
 echo_i "test 'dig +notcp ixfr=<value>' vs 'dig ixfr=<value> +notcp' vs 'dig ixfr=<value>' ($n)"
@@ -310,27 +247,22 @@ $DIG $DIGOPTS +notcp ixfr=1 test @10.53.0.4 > dig.out1.test$n || ret=1
 $DIG $DIGOPTS ixfr=1 +notcp test @10.53.0.4 > dig.out2.test$n || ret=1
 digcomp dig.out1.test$n dig.out2.test$n || ret=1
 awk '$4 == "SOA" { soacnt++} END {if (soacnt == 1) exit(0); else exit(1);}' dig.out1.test$n || ret=1
-awk '$4 == "SOA" { if ($7 == 4) exit(0); else exit(1);}' dig.out1.test$n || ret=1
+awk '$4 == "SOA" { if ($7 == 3) exit(0); else exit(1);}' dig.out1.test$n || ret=1
 # Should be incremental transfer.
 $DIG $DIGOPTS ixfr=1 test @10.53.0.4 > dig.out3.test$n || ret=1
 awk '$4 == "SOA" { soacnt++} END { if (soacnt == 6) exit(0); else exit(1);}' dig.out3.test$n || ret=1
-if [ ${ret} != 0 ]; then
-       echo_i "failed"
-       status=1
-fi
-
-# wait for slave to transfer zone
-for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
-do
-       $DIG $DIGOPTS +tcp @10.53.0.5 SOA test > dig.out.test$n
-       grep -i "hostmaster\.test\..4" dig.out.test$n > /dev/null && break
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
 
-       # re-notify if we've been waiting a long time
-       if [ $i -ge 5 ]; then
-           $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i
-       fi
-       sleep 1
-done
+# make sure ns5 has transfered the zone
+# wait for slave to reload
+tret=0
+retry_quiet 5 wait_for_serial 10.53.0.5 test. 4 dig.out.test$n || tret=1
+if [ $tret -eq 1 ]; then
+    # re-noitfy after 5 seconds, then wait another 10
+    $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i
+    retry_quiet 10 wait_for_serial 10.53.0.5 test. 3 dig.out.test$n || ret=1
+fi
 
 n=$((n+1))
 echo_i "test 'provide-ixfr no;' ($n)"
@@ -341,42 +273,59 @@ $DIG $DIGOPTS ixfr=1 test @10.53.0.5 > dig.out1.test$n || ret=1
 $DIG $DIGOPTS ixfr=1 +notcp test @10.53.0.5 > dig.out2.test$n || ret=1
 awk '$4 == "SOA" { soacnt++} END {if (soacnt == 2) exit(0); else exit(1);}' dig.out1.test$n || ret=1
 awk '$4 == "SOA" { soacnt++} END {if (soacnt == 1) exit(0); else exit(1);}' dig.out2.test$n || ret=1
-if [ ${ret} != 0 ]; then
-       echo_i "failed"
-       status=1
-fi
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
 
 n=$((n+1))
 echo_i "checking whether dig calculates IXFR statistics correctly ($n)"
 ret=0
 $DIG $DIGOPTS +noedns +stat -b 10.53.0.4 @10.53.0.4 test. ixfr=2 > dig.out1.test$n
 get_dig_xfer_stats dig.out1.test$n > stats.dig
-diff ixfr-stats.good stats.dig || ret=1
+diff ixfr-stats.good stats.dig > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((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".
+
+_wait_for_stats () {
+    get_named_xfer_stats ns4/named.run "$1" test "$2" > "$3"
+    diff ixfr-stats.good "$3" > /dev/null || return 1
+    return 0
+}
+
 n=$((n+1))
 echo_i "checking whether named calculates incoming IXFR statistics correctly ($n)"
 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
+retry_quiet 10 _wait_for_stats 10.53.0.3 "Transfer completed" stats.incoming
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
 n=$((n+1))
 echo_i "checking whether named calculates outgoing IXFR statistics correctly ($n)"
-ret=1
-for i in 0 1 2 3 4 5 6 7 8 9; do
-       get_named_xfer_stats ns4/named.run 10.53.0.4 test "IXFR ended" > stats.outgoing
-       if diff ixfr-stats.good stats.outgoing > /dev/null; then
-               ret=0
-               break
-       fi
-       sleep 1
-done
+retry_quiet 10 _wait_for_stats 10.53.0.4 "IXFR ended" stats.outgoing
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
+n=$((n+1))
+ret=0
+echo_i "testing fallback to AXFR when max-ixfr-ratio is exceeded ($n)"
+nextpart ns4/named.run > /dev/null
+
+cp ns3/mytest3.db ns3/mytest.db # change to test zone, too big for IXFR
+$RNDCCMD 10.53.0.3 reload | sed 's/^/ns3 /' | cat_i
+
+# wait for slave to reload
+tret=0
+retry_quiet 5 wait_for_serial 10.53.0.4 test. 4 dig.out.test$n || tret=1
+if [ $tret -eq 1 ]; then
+    # re-noitfy after 5 seconds, then wait another 10
+    $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i
+    retry_quiet 10 wait_for_serial 10.53.0.4 test. 4 dig.out.test$n || ret=1
+fi
+
+wait_for_log 10 'got nonincremental response' ns4/named.run || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
index 690a3055c96306f7e5813853d26f9663b8b7524d..f5f9b4c02c33eb2c2096ce749d2f583ed7184bfe 100644 (file)
 ./bin/tests/system/ixfr/ans2/startme           X       2011,2018,2019,2020
 ./bin/tests/system/ixfr/clean.sh               SH      2001,2004,2007,2011,2012,2014,2015,2016,2018,2019,2020
 ./bin/tests/system/ixfr/ixfr-stats.good                X       2019,2020
-./bin/tests/system/ixfr/ns1/startme            X       2012,2013,2018,2019,2020
 ./bin/tests/system/ixfr/prereq.sh              SH      2001,2004,2007,2012,2014,2016,2018,2019,2020
 ./bin/tests/system/ixfr/setup.sh               SH      2001,2004,2007,2011,2012,2013,2014,2016,2018,2019,2020
 ./bin/tests/system/ixfr/tests.sh               SH      2001,2004,2007,2011,2012,2014,2016,2018,2019,2020