From: Colin Vidal Date: Thu, 19 Feb 2026 15:56:10 +0000 (+0100) Subject: Fix cacheclean system test for parent-centric resolver X-Git-Tag: v9.21.21~4^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6735613af38dec264a5a111a6cfc1ff86b7e9868;p=thirdparty%2Fbind9.git Fix cacheclean system test for parent-centric resolver 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. --- diff --git a/bin/tests/system/cacheclean/ns1/bar.com.db b/bin/tests/system/cacheclean/ns1/bar.com.db new file mode 100644 index 00000000000..7bd7b4a5a03 --- /dev/null +++ b/bin/tests/system/cacheclean/ns1/bar.com.db @@ -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. diff --git a/bin/tests/system/cacheclean/ns1/example.db b/bin/tests/system/cacheclean/ns1/example.db index 7262109dc30..bc8c2e48c74 100644 --- a/bin/tests/system/cacheclean/ns1/example.db +++ b/bin/tests/system/cacheclean/ns1/example.db @@ -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 diff --git a/bin/tests/system/cacheclean/ns1/named.conf.j2 b/bin/tests/system/cacheclean/ns1/named.conf.j2 index fa6fe276b2f..11f22e82790 100644 --- a/bin/tests/system/cacheclean/ns1/named.conf.j2 +++ b/bin/tests/system/cacheclean/ns1/named.conf.j2 @@ -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"; diff --git a/bin/tests/system/cacheclean/ns2/named.args b/bin/tests/system/cacheclean/ns2/named.args index 2482aade6c4..5482e01c59e 100644 --- a/bin/tests/system/cacheclean/ns2/named.args +++ b/bin/tests/system/cacheclean/ns2/named.args @@ -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 index 00000000000..43f97c6d931 --- /dev/null +++ b/bin/tests/system/cacheclean/ns3/foo.bar.com.db @@ -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 index 00000000000..c00fb203546 --- /dev/null +++ b/bin/tests/system/cacheclean/ns3/named.conf.j2 @@ -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"; +}; + diff --git a/bin/tests/system/cacheclean/tests.sh b/bin/tests/system/cacheclean/tests.sh index 5359107508d..fe71c2f8627 100755 --- a/bin/tests/system/cacheclean/tests.sh +++ b/bin/tests/system/cacheclean/tests.sh @@ -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))