From d1433da5248f8b864db8b3926234fce49901a963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 14 Jul 2022 15:37:32 +0200 Subject: [PATCH] Wait for TCP connection refused in the statistics system test The statistics system test makes a query to foo.info to check for the pending connections because the ans4 doesn't respond to the query. This might or might not (depending on exact timing) increment the failed TCP connection counter when the query is retried over TCP because ans4 doesn't listen on the TCP. Wait for the 'connection refused' in the ns3 log file to be able to count the exactly 1 failed TCP connection. --- bin/tests/system/statistics/clean.sh | 2 +- bin/tests/system/statistics/tests.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/tests/system/statistics/clean.sh b/bin/tests/system/statistics/clean.sh index da49585395..37fa7dc9af 100644 --- a/bin/tests/system/statistics/clean.sh +++ b/bin/tests/system/statistics/clean.sh @@ -29,4 +29,4 @@ rm -f ns*/named.lock rm -f stats*out rm -f ns*/managed-keys.bind* rm -f xsltproc.out.* -rm -f named.stats.* +rm -f named.stats.* ns*/named.stats.* diff --git a/bin/tests/system/statistics/tests.sh b/bin/tests/system/statistics/tests.sh index 02125ae772..d21b4622b7 100644 --- a/bin/tests/system/statistics/tests.sh +++ b/bin/tests/system/statistics/tests.sh @@ -144,6 +144,8 @@ if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` n=`expr $n + 1` +wait_for_log 10 "connection refused" ns3/named.stats + ret=0 echo_i "checking that zones with slash are properly shown in XML output ($n)" if $FEATURETEST --have-libxml2 && [ -x ${CURL} ] ; then @@ -232,7 +234,7 @@ if $FEATURETEST --have-libxml2 && [ -e stats.xml.out ] && [ -x "${XSLTPROC}" ] # Socket statistics (expect no errors) grep "0" stats.xml.out >/dev/null || ret=1 grep "0" stats.xml.out >/dev/null || ret=1 - grep "0" stats.xml.out >/dev/null || ret=1 + grep "1" stats.xml.out >/dev/null || ret=1 grep "0" stats.xml.out >/dev/null || ret=1 grep "0" stats.xml.out >/dev/null || ret=1 # grep "0" stats.xml.out >/dev/null || ret=1