From: Diego Fronza Date: Tue, 20 Oct 2020 00:24:38 +0000 (-0300) Subject: Adjusted ancient rrset system test X-Git-Tag: v9.17.7~5^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc074f15a828dcb572dc1f75d022918224569a35;p=thirdparty%2Fbind9.git Adjusted ancient rrset system test Before the stale-refresh-time feature, the system test for ancient rrset was somewhat based on the average time the previous tests and queries were taking, thus not very precise. After the addition of stale-refresh-time the system test for ancient rrset started to fail since the queries for stale records (low max-stale-ttl) were not taking the time to do a full resolution anymore, since the answers now were coming from the cache (because the rrset were stale and within stale-refresh-time window after the previous resolution failure). To handle this, the correct time to wait before rrset become ancient is calculated from max-stale-ttl configuration plus the TTL set in the rrset used in the tests (ans2/ans.pl). Then before sending queries for ancient rrset, we check if we need to sleep enough to ensure those rrset will be marked as ancient. --- diff --git a/bin/tests/system/serve-stale/tests.sh b/bin/tests/system/serve-stale/tests.sh index 518396bde4a..e5bfcbb0181 100755 --- a/bin/tests/system/serve-stale/tests.sh +++ b/bin/tests/system/serve-stale/tests.sh @@ -471,6 +471,10 @@ grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) +# keep track of time so we can access these rrset later, +# when we expect them to become ancient. +t1=`$PERL -e 'print time()'` + n=$((n+1)) echo_i "prime cache othertype.example (low max-stale-ttl) ($n)" ret=0 @@ -594,6 +598,20 @@ grep "1 #NXDOMAIN" ns1/named.stats.$n.cachedb > /dev/null || ret=1 status=$((status+ret)) if [ $ret != 0 ]; then echo_i "failed"; fi +# retrieve max-stale-ttl value, +interval_to_ancient=`grep 'max-stale-ttl' ns1/named2.conf.in | awk '{ print $2 }' | tr -d ';'` +# we add 2 seconds to it since this is the ttl value of the records being tested. +interval_to_ancient=$((interval_to_ancient + 2)) +t2=`$PERL -e 'print time()'` +elapsed=$((t2 - t1)) + +# if elapsed time so far is less than max-stale-ttl + 2 seconds, +# then we sleep enough to ensure that we'll ask for ancient rrsets +# in the next queries. +if [ $elapsed -lt $interval_to_ancient ]; then + sleep $((interval_to_ancient - elapsed)) +fi + echo_i "sending queries for tests $((n+1))-$((n+4))..." $DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$((n+1)) & $DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$((n+2)) &