]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add another prefetch check in the resolver system test
authorAram Sargsyan <aram@isc.org>
Tue, 18 Oct 2022 13:06:19 +0000 (13:06 +0000)
committerAram Sargsyan <aram@isc.org>
Fri, 21 Oct 2022 10:30:13 +0000 (10:30 +0000)
The test triggers a prefetch, but fails to check if it acutally
happened, which prevented it from catching a bug when the record's
TTL value matches the configured prefetch eligibility value.

Check that prefetch happened by comparing the TTL values.

(cherry picked from commit 89fa9a65927eb0542afaef55714d77953f09f0e0)

bin/tests/system/resolver/ns4/tld2.db
bin/tests/system/resolver/tests.sh

index 2d8f428cb9cd080ed563bd48ab0a6ea0206f407c..45dc6943a530b2d2426da9a48d1266d30f7885ff 100644 (file)
@@ -21,9 +21,9 @@ $TTL 300
 ns                     A       10.53.0.4
 fetch.tld.             NS      ns.fetch.tld.
 ns.fetch.tld.          A       10.53.0.6
-fetchall  10              TXT     A short ttl
 fetchall  10              A     1.2.3.4
-fetchall  10              AAAA    ::1
+fetchall  10              AAAA  ::1
+fetchall  10              TXT   A short ttl
 no-edns-version.tld.   NS      ns.no-edns-version.tld.
 ns.no-edns-version.tld.        A       10.53.0.6
 edns-version.tld.      NS      ns.edns-version.tld.
index 0e52e8eed65181e8f0916a2b29b05151128cb095..111ded080bc97e38da97a843b6be6417d8ac3b67 100755 (executable)
@@ -562,8 +562,12 @@ sleep ${ttl1:-0}
 $DIG $DIGOPTS @10.53.0.5 fetchall.tld any > dig.out.2.${n} || ret=1
 ttl2=`awk '/"A" "short" "ttl"/ { print $2 }' dig.out.2.${n}`
 sleep 1
-# check that the nameserver is still alive
+# check that prefetch occurred;
+# note that only one record is prefetched, which is the TXT record in this case,
+# because of the order of the records in the cache
 $DIG $DIGOPTS @10.53.0.5 fetchall.tld any > dig.out.3.${n} || ret=1
+ttl3=`awk '/"A" "short" "ttl"/ { print $2 }' dig.out.3.${n}`
+test ${ttl3:-0} -gt ${ttl2:-1} || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`