]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix cacheclean system test for parent-centric resolver
authorColin Vidal <colin@isc.org>
Thu, 19 Feb 2026 15:56:10 +0000 (16:56 +0100)
committerColin Vidal <colin@isc.org>
Mon, 30 Mar 2026 18:41:13 +0000 (20:41 +0200)
The ADB flushtree test was failing because the test zone
(flushtest.example.) uses an in-domain nameserver with parent glue,
so the ADB cache was never populated.

Add a new zone with an out-of-domain nameserver to force an ADB
lookup and ensure the flushtree test exercises the intended code
path.

bin/tests/system/cacheclean/ns1/bar.com.db [new file with mode: 0644]
bin/tests/system/cacheclean/ns1/example.db
bin/tests/system/cacheclean/ns1/named.conf.j2
bin/tests/system/cacheclean/ns2/named.args
bin/tests/system/cacheclean/ns3/foo.bar.com.db [new file with mode: 0644]
bin/tests/system/cacheclean/ns3/named.conf.j2 [new file with mode: 0644]
bin/tests/system/cacheclean/tests.sh

diff --git a/bin/tests/system/cacheclean/ns1/bar.com.db b/bin/tests/system/cacheclean/ns1/bar.com.db
new file mode 100644 (file)
index 0000000..7bd7b4a
--- /dev/null
@@ -0,0 +1,22 @@
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+;
+; SPDX-License-Identifier: MPL-2.0
+;
+; 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.
+
+$TTL 999999
+bar.com.             IN SOA  hostmaster.nominum.com. a.root-servers.nil. (
+                                2000042100
+                                600
+                                600
+                                1200
+                                600
+                                )
+                       IN      NS      ns
+ns                     IN      A       10.53.0.1
+foo                    IN      NS      ns.somehost.com.
index 7262109dc30e4fca54d4990523fe5ae11d58b38b..bc8c2e48c745dc0c07ef5fb0c0e653e44f6d271b 100644 (file)
@@ -2940,3 +2940,5 @@ $ORIGIN NETFLIGHT.com.
 DNS                    IN      A       207.88.32.2
 $ORIGIN MERCHANTWARE.CON.
 NS1                    IN      A       209.170.142.34
+$ORIGIN somehost.com.
+ns                     IN      A       10.53.0.3
index fa6fe276b2f59339eaa074b748fd793bfc7b8a32..11f22e82790a440be3f4c58bdcffa18c69e4f24a 100644 (file)
@@ -32,6 +32,11 @@ zone "." {
        file "example.db";
 };
 
+zone "bar.com" {
+       type primary;
+       file "bar.com.db";
+};
+
 zone "flushtest.example" {
        type primary;
        file "flushtest.db";
index 2482aade6c436851246dad77c12b2021d4bb8ed5..5482e01c59e1c22c6796abf54097d43346a97d6f 100644 (file)
@@ -1 +1 @@
--m record -c named.conf -d 3 -D cacheclean-ns2 -g -T maxcachesize=2097152
+-m record -c named.conf -d 99 -D cacheclean-ns2 -g -T maxcachesize=2097152
diff --git a/bin/tests/system/cacheclean/ns3/foo.bar.com.db b/bin/tests/system/cacheclean/ns3/foo.bar.com.db
new file mode 100644 (file)
index 0000000..43f97c6
--- /dev/null
@@ -0,0 +1,21 @@
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+;
+; SPDX-License-Identifier: MPL-2.0
+;
+; 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.
+
+$TTL 999999
+foo.bar.com.             IN SOA  hostmaster.nominum.com. a.root-servers.nil. (
+                                2000042100
+                                600
+                                600
+                                1200
+                                600
+                                )
+                       IN      NS      ns.somehost.com.
+gee                    IN      A       9.9.9.9
diff --git a/bin/tests/system/cacheclean/ns3/named.conf.j2 b/bin/tests/system/cacheclean/ns3/named.conf.j2
new file mode 100644 (file)
index 0000000..c00fb20
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * SPDX-License-Identifier: MPL-2.0
+ *
+ * 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.3;
+       notify-source 10.53.0.3;
+       transfer-source 10.53.0.3;
+       port @PORT@;
+       pid-file "named.pid";
+       listen-on { 10.53.0.3; };
+       listen-on-v6 { none; };
+       allow-transfer { any; };
+       recursion no;
+       dnssec-validation no;
+       notify yes;
+       check-integrity no;
+       minimal-responses no;
+};
+
+zone "foo.bar.com" {
+       type primary;
+       file "foo.bar.com.db";
+};
+
index 5359107508d27c3c4f4a65d7fe13917a335f6813..fe71c2f8627d57242529bfc90bf6990a8782beed 100755 (executable)
@@ -242,20 +242,23 @@ status=$((status + ret))
 n=$((n + 1))
 echo_i "check flushtree clears adb correctly ($n)"
 ret=0
-load_cache
+# Because the resolver is parent centric, no NS will be used from ADB using
+# flushtest.example, as the NS is in-domain. So force an NS lookup using
+# foo.bar.com domain.
+$DIG @10.53.0.2 -p ${PORT} A gee.foo.bar.com >/dev/null
 dump_cache
 mv ns2/named_dump.db.test$n ns2/named_dump.db.test$n.a
 sed -n '/plain success\/timeout/,/Unassociated entries/p' \
   ns2/named_dump.db.test$n.a >sed.out.$n.a
 grep 'plain success/timeout' sed.out.$n.a >/dev/null 2>&1 || ret=1
-grep 'ns.flushtest.example' sed.out.$n.a >/dev/null 2>&1 || ret=1
-$RNDC $RNDCOPTS flushtree flushtest.example || ret=1
+grep 'ns.somehost.com.' sed.out.$n.a >/dev/null 2>&1 || ret=1
+$RNDC $RNDCOPTS flushtree com. || ret=1
 dump_cache
 mv ns2/named_dump.db.test$n ns2/named_dump.db.test$n.b
 sed -n '/plain success\/timeout/,/Unassociated entries/p' \
   ns2/named_dump.db.test$n.b >sed.out.$n.b
 grep 'plain success/timeout' sed.out.$n.b >/dev/null 2>&1 || ret=1
-grep 'ns.flushtest.example' sed.out.$n.b >/dev/null 2>&1 && ret=1
+grep 'ns.somehost.com.' sed.out.$n.b >/dev/null 2>&1 && ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))