From: Diego Fronza Date: Mon, 2 Dec 2019 22:19:56 +0000 (-0300) Subject: Fix resolver tests: prefetch 40/41 X-Git-Tag: v9.14.10~23^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd1b4007b8ab6e3a14794ca9e9bb6e4e4a8d5744;p=thirdparty%2Fbind9.git Fix resolver tests: prefetch 40/41 These two tests were failing basically because in order for prefetching to happen, the TTL for a given DNS record must be greater than or equal to the prefetch config value + 9. The previous TTL for both records was 10, while prefetch value in configuration was 3, thus making only records with TTL >= 12 elligible for prefetching. TTL value for both records was adjusted to the value 13, and prefetch value was set to 4 (inc by 1), so records with TTL (4 + 9) >= 13 are elligible for prefetching. Adjusting prefetch value to 4 gives the test 1 second more to avoid time problems when sharing resources on a heavy loaded PC. Also prefetch value in settings is now read by the script and used by it to corrrectly calculate the amount of time needed to delay before sending a request to trigger prefetch, adding a bit of flexibility to fine tune the test in the future. (cherry picked from commit a711d6f8c012d65da2635e857e0d6a04b859c428) --- diff --git a/bin/tests/system/resolver/ns5/named.conf.in b/bin/tests/system/resolver/ns5/named.conf.in index b1d431e7038..c81a3ba5de4 100644 --- a/bin/tests/system/resolver/ns5/named.conf.in +++ b/bin/tests/system/resolver/ns5/named.conf.in @@ -22,6 +22,7 @@ options { recursion yes; dnssec-validation yes; querylog yes; + prefetch 4 10; }; server 10.53.0.7 { diff --git a/bin/tests/system/resolver/ns6/example.net.db.in b/bin/tests/system/resolver/ns6/example.net.db.in index fa4e96aad84..eab3267b79d 100644 --- a/bin/tests/system/resolver/ns6/example.net.db.in +++ b/bin/tests/system/resolver/ns6/example.net.db.in @@ -16,6 +16,6 @@ mail IN A 10.53.0.6 fetch 10 IN TXT A short ttl non-zero 10 IN TXT A short ttl zero 0 IN TXT A zero ttl -$TTL 10 +$TTL 13 ds IN NS ns.ds ns.ds IN A 10.53.0.6 diff --git a/bin/tests/system/resolver/ns6/fetch.tld.db b/bin/tests/system/resolver/ns6/fetch.tld.db index 3754373ec7c..b38fd516011 100644 --- a/bin/tests/system/resolver/ns6/fetch.tld.db +++ b/bin/tests/system/resolver/ns6/fetch.tld.db @@ -18,4 +18,4 @@ $TTL 300 @ NS ns.fetch.tld. ns.fetch.tld. A 10.53.0.6 -@ 10 TXT A short ttl +@ 13 TXT A short ttl diff --git a/bin/tests/system/resolver/tests.sh b/bin/tests/system/resolver/tests.sh index ee886fd0b29..73133bb1185 100755 --- a/bin/tests/system/resolver/tests.sh +++ b/bin/tests/system/resolver/tests.sh @@ -451,10 +451,13 @@ status=`expr $status + $ret` n=`expr $n + 1` echo_i "check prefetch (${n})" ret=0 +# read prefetch value from config. +PREFETCH=`sed -n "s/[[:space:]]*prefetch \([0-9]\).*/\1/p" ns5/named.conf` $DIG $DIGOPTS @10.53.0.5 fetch.tld txt > dig.out.1.${n} || ret=1 -ttl1=`awk '/"A" "short" "ttl"/ { print $2 - 2 }' dig.out.1.${n}` +ttl1=`awk '/"A" "short" "ttl"/ { print $2 }' dig.out.1.${n}` +interval=$((ttl1 - PREFETCH + 1)) # sleep so we are in prefetch range -sleep ${ttl1:-0} +sleep ${interval:-0} # trigger prefetch $DIG $DIGOPTS @10.53.0.5 fetch.tld txt > dig.out.2.${n} || ret=1 ttl2=`awk '/"A" "short" "ttl"/ { print $2 }' dig.out.2.${n}` @@ -470,9 +473,10 @@ n=`expr $n + 1` echo_i "check prefetch of validated DS's RRSIG TTL is updated (${n})" ret=0 $DIG $DIGOPTS +dnssec @10.53.0.5 ds.example.net ds > dig.out.1.${n} || ret=1 -dsttl1=`awk '$4 == "DS" && $7 == "1" { print $2 - 2 }' dig.out.1.${n}` +dsttl1=`awk '$4 == "DS" && $7 == "1" { print $2 }' dig.out.1.${n}` # sleep so we are in prefetch range -sleep ${dsttl1:-0} +interval=$((dsttl1 - PREFETCH + 1)) +sleep ${interval:-0} # trigger prefetch $DIG $DIGOPTS @10.53.0.5 ds.example.net ds > dig.out.2.${n} || ret=1 dsttl2=`awk '$4 == "DS" && $7 == "1" { print $2 }' dig.out.2.${n}`