[9.20] fix: test: Fix the nslookup system test

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).

Closes #4948

Backport of MR !9523

Merge branch 'backport-4948-nslookup-test-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9791
This commit is contained in:
Arаm Sаrgsyаn 2024-11-27 15:54:01 +00:00
commit 894295a926

View file

@ -85,7 +85,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
@ -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 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
@ -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 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