2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Update nsupdate test

The nsupdate system test did not record failures from the
'update_test.pl' Perl script. This was because the 'ret' value was
not being saved outside the '{ $PERL ... || ret=1 } cat_i' scope.

Change this piece to store the output in a separate file and then
cat its contents. Now the 'ret' value is being saved.

Also record failures in 'update_test.pl' if sending the update
failed.

Add missing 'n' incrementals to 'nsupdate/test.sh' to keep track of
test numbers.
This commit is contained in:
Matthijs Mekking
2021-04-30 11:03:46 +02:00
parent 9d04a731ba
commit 5b31811b5f
3 changed files with 30 additions and 16 deletions

View File

@@ -58,6 +58,7 @@ rm -f ns9/_default.tsigkeys
rm -f ns9/denyname.example.db
rm -f ns9/example.com.db
rm -f ns9/in-addr.db
rm -f perl.update_test.out
rm -f nsupdate.out*
rm -f typelist.out.*
rm -f update.out.*

View File

@@ -303,36 +303,43 @@ elif [ "$serial" -gt "$now" ]; then
fi
[ $ret = 0 ] || { echo_i "failed"; status=1; }
ret=0
if $PERL -e 'use Net::DNS;' 2>/dev/null
then
echo_i "running update.pl test"
{
$PERL update_test.pl -s 10.53.0.1 -p ${PORT} update.nil. || ret=1
} | cat_i
n=`expr $n + 1`
ret=0
echo_i "running update.pl test ($n)"
$PERL update_test.pl -s 10.53.0.1 -p ${PORT} update.nil. > perl.update_test.out || ret=1
[ $ret -eq 1 ] && { echo_i "failed"; status=1; }
if $PERL -e 'use Net::DNS; die "Net::DNS too old ($Net::DNS::VERSION < 1.01)" if ($Net::DNS::VERSION < 1.01)' > /dev/null
then
grep "updating zone 'update.nil/IN': too many NSEC3 iterations (151)" ns1/named.run > /dev/null || ret=1
n=`expr $n + 1`
ret=0
echo_i "check for too many NSEC3 iterations log ($n)"
grep "updating zone 'update.nil/IN': too many NSEC3 iterations (151)" ns1/named.run > /dev/null || ret=1
[ $ret -eq 1 ] && { echo_i "failed"; status=1; }
fi
[ $ret -eq 1 ] && { echo_i "failed"; status=1; }
else
echo_i "The second part of this test requires the Net::DNS library." >&2
fi
n=`expr $n + 1`
ret=0
echo_i "fetching first copy of test zone"
echo_i "fetching first copy of test zone ($n)"
$DIG $DIGOPTS +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
@10.53.0.1 axfr > dig.out.ns1 || ret=1
[ $ret = 0 ] || { echo_i "failed"; status=1; }
n=`expr $n + 1`
ret=0
echo_i "fetching second copy of test zone"
echo_i "fetching second copy of test zone ($n)"
$DIG $DIGOPTS +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
@10.53.0.2 axfr > dig.out.ns2 || ret=1
[ $ret = 0 ] || { echo_i "failed"; status=1; }
n=`expr $n + 1`
ret=0
echo_i "comparing zones"
echo_i "comparing zones ($n)"
digcomp dig.out.ns1 dig.out.ns2 || ret=1
[ $ret = 0 ] || { echo_i "failed"; status=1; }
@@ -352,21 +359,24 @@ else
fi
sleep 10
n=`expr $n + 1`
ret=0
echo_i "fetching ns1 after hard restart"
echo_i "fetching ns1 after hard restart ($n)"
$DIG $DIGOPTS +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
@10.53.0.1 axfr > dig.out.ns1.after || ret=1
[ $ret = 0 ] || { echo_i "failed"; status=1; }
n=`expr $n + 1`
ret=0
echo_i "comparing zones"
echo_i "comparing zones ($n)"
digcomp dig.out.ns1 dig.out.ns1.after || ret=1
[ $ret = 0 ] || { echo_i "failed"; status=1; }
echo_i "begin RT #482 regression test"
n=`expr $n + 1`
ret=0
echo_i "update primary"
echo_i "update primary ($n)"
$NSUPDATE -k ns1/ddns.key <<END > /dev/null || ret=1
server 10.53.0.1 ${PORT}
update add updated2.example.nil. 600 A 10.10.10.2
@@ -388,8 +398,9 @@ fi
sleep 5
n=`expr $n + 1`
ret=0
echo_i "update primary again"
echo_i "update primary again ($n)"
$NSUPDATE -k ns1/ddns.key <<END > /dev/null || ret=1
server 10.53.0.1 ${PORT}
update add updated3.example.nil. 600 A 10.10.10.3
@@ -411,7 +422,8 @@ fi
sleep 5
echo_i "check to 'out of sync' message"
n=`expr $n + 1`
echo_i "check to 'out of sync' message ($n)"
if grep "out of sync" ns2/named.run
then
echo_i "failed (found 'out of sync')"

View File

@@ -58,7 +58,7 @@ sub assert {
my ($cond, $explanation) = @_;
if (!$cond) {
print "Test Failed: $explanation ***\n";
$failures++
$failures++;
}
}
@@ -79,6 +79,7 @@ sub test {
assert($rcode eq $expected, "expected $expected, got $rcode");
} else {
print "Update failed: ", $res->errorstring, "\n";
$failures++;
}
}