From 5307bf64ce802cb2d8aa4a59c283fd0c581d41ff Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Sat, 26 Sep 2020 23:27:24 -0700 Subject: [PATCH] reduce timing dependencies in system tests one of the tests in the resolver system test depends on dig getting no response to its first two query attempts, and SERVFAIL on the third after resolution times out. using a 5-second retry timer in dig means the SERVFAIL response could occur while dig is discarding the second query and preparing to send the third. in this case the server's response could be missed. shortening the retry interval to 4 seconds ensures that dig has already sent the third query when the SERVFAIL response arrives. also, the serve-stale system test could fail due to a race in which it timed out after waiting ten seconds for a file to be written, and the dig timeout was just a bit longer. this is addressed by extending the dig timeout to 11 seconds for this test. --- bin/tests/system/resolver/tests.sh | 4 ++-- bin/tests/system/serve-stale/tests.sh | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/tests/system/resolver/tests.sh b/bin/tests/system/resolver/tests.sh index 3874361fb5..a958103c0a 100755 --- a/bin/tests/system/resolver/tests.sh +++ b/bin/tests/system/resolver/tests.sh @@ -805,7 +805,7 @@ status=`expr $status + $ret` n=`expr $n + 1` echo_i "check that the resolver accepts a reply with empty question section with TC=1 and retries over TCP ($n)" ret=0 -$DIG $DIGOPTS @10.53.0.5 truncated.no-questions. a +tries=3 +time=5 > dig.ns5.out.${n} || ret=1 +$DIG $DIGOPTS @10.53.0.5 truncated.no-questions. a +tries=3 +time=4 > dig.ns5.out.${n} || ret=1 grep "status: NOERROR" dig.ns5.out.${n} > /dev/null || ret=1 grep "ANSWER: 1," dig.ns5.out.${n} > /dev/null || ret=1 grep "1\.2\.3\.4" dig.ns5.out.${n} > /dev/null || ret=1 @@ -815,7 +815,7 @@ status=`expr $status + $ret` n=`expr $n + 1` echo_i "check that the resolver rejects a reply with empty question section with TC=0 ($n)" ret=0 -$DIG $DIGOPTS @10.53.0.5 not-truncated.no-questions. a +tries=3 +time=5 > dig.ns5.out.${n} || ret=1 +$DIG $DIGOPTS @10.53.0.5 not-truncated.no-questions. a +tries=3 +time=4 > dig.ns5.out.${n} || ret=1 grep "status: NOERROR" dig.ns5.out.${n} > /dev/null && ret=1 grep "ANSWER: 1," dig.ns5.out.${n} > /dev/null && ret=1 grep "1\.2\.3\.4" dig.ns5.out.${n} > /dev/null && ret=1 diff --git a/bin/tests/system/serve-stale/tests.sh b/bin/tests/system/serve-stale/tests.sh index b787c816ab..518396bde4 100755 --- a/bin/tests/system/serve-stale/tests.sh +++ b/bin/tests/system/serve-stale/tests.sh @@ -13,14 +13,16 @@ RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s" -# wait up to ten seconds to ensure that a file has been written +# wait up to 11 seconds to ensure that a file has been written waitfile () { - for try in 0 1 2 3 4 5 6 7 8 9; do + for try in 0 1 2 3 4 5 6 7 8 9 10; do [ -s "$1" ] && break sleep 1 done } +DIG="$DIG +time=11" + max_stale_ttl=$(sed -ne 's,^[[:space:]]*max-stale-ttl \([[:digit:]]*\).*,\1,p' $TOP_SRCDIR/bin/named/config.c) status=0