]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix the nslookup system test
authorAram Sargsyan <aram@isc.org>
Thu, 19 Sep 2024 14:47:49 +0000 (14:47 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Wed, 27 Nov 2024 13:35:30 +0000 (13:35 +0000)
The nslookup system test checks the count of resolved addresses in
the CNAME tests using a 'grep' match on the hostname, and ignoring
lines containing the 'canonical name' string. In order to protect
the check from intermittent failures like the 'address in use' warning
message, which then automatically resolves after a retry, edit the
'grep' matching string to also ignore the comments (as the mentioned
warning message is a comment which contains the hostname).

(cherry picked from commit 345b0f9e5ca075243e4ac662b4be299666be3207)

bin/tests/system/nslookup/tests.sh

index c68b5cfc09246964ea0434ccf2bd08052e6c137f..32430320c949e3745536bede5fb257e1e3ecee6a 100644 (file)
@@ -101,7 +101,7 @@ lines=$(grep -c "Server:" nslookup.out${n})
 test $lines -eq 1 || ret=1
 lines=$(grep -c "canonical name" nslookup.out${n})
 test $lines -eq 1 || ret=1
-lines=$(grep a-only.example.net nslookup.out${n} | grep -cv "canonical name")
+lines=$(grep a-only.example.net nslookup.out${n} | grep -cEv "(canonical name|^;;)")
 test $lines -eq 1 || ret=1
 grep "1.2.3.4" nslookup.out${n} >/dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
@@ -117,7 +117,7 @@ lines=$(grep -c "Server:" nslookup.out${n})
 test $lines -eq 1 || ret=1
 lines=$(grep -c "canonical name" nslookup.out${n})
 test $lines -eq 1 || ret=1
-lines=$(grep aaaa-only.example.net nslookup.out${n} | grep -cv "canonical name")
+lines=$(grep aaaa-only.example.net nslookup.out${n} | grep -cEv "(canonical name|^;;)")
 test $lines -eq 1 || ret=1
 grep "2001::ffff" nslookup.out${n} >/dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
@@ -133,7 +133,7 @@ lines=$(grep -c "Server:" nslookup.out${n})
 test $lines -eq 1 || ret=1
 lines=$(grep -c "canonical name" nslookup.out${n})
 test $lines -eq 1 || ret=1
-lines=$(grep dual.example.net nslookup.out${n} | grep -cv "canonical name")
+lines=$(grep dual.example.net nslookup.out${n} | grep -cEv "(canonical name|^;;)")
 test $lines -eq 2 || ret=1
 grep "1.2.3.4" nslookup.out${n} >/dev/null || ret=1
 grep "2001::ffff" nslookup.out${n} >/dev/null || ret=1