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 a711d6f8c0)
This commit is contained in:
Diego Fronza
2020-01-09 11:44:44 +01:00
committed by Michał Kępień
parent f06c1dde90
commit 89129a3a85
5 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ ns A 10.53.0.4
$TTL 5
to-be-removed NS ns.to-be-removed
ns.to-be-removed A 10.53.0.6
fetch 10 TXT A short ttl
fetch 13 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.
+1 -1
View File
@@ -17,7 +17,7 @@ $TTL 300
)
@ NS ns.tld.
ns A 10.53.0.4
fetch 10 TXT A short ttl
fetch 13 TXT A short ttl
fetchall 10 TXT A short ttl
fetchall 10 A 1.2.3.4
fetchall 10 AAAA ::1
@@ -21,6 +21,7 @@ options {
listen-on-v6 { none; };
recursion yes;
querylog yes;
prefetch 4 10;
};
server 10.53.0.7 {
@@ -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
+8 -4
View File
@@ -443,10 +443,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}`
@@ -462,9 +465,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}`