Commit abe41ba0 authored by Mark Andrews's avatar Mark Andrews
Browse files

use guard values for testing unixtime serial

parent 6b30bc73
Pipeline #3369 passed with stages
in 13 minutes and 28 seconds
......@@ -268,6 +268,7 @@ ret=0
echo_i "check that unixtime serial number is correctly generated ($n)"
$DIG $DIGOPTS +short unixtime.nil. soa @10.53.0.1 > dig.out.old.test$n || ret=1
oldserial=`awk '{print $3}' dig.out.old.test$n` || ret=1
start=`$PERL -e 'print time()."\n";'`
$NSUPDATE <<END > /dev/null 2>&1 || ret=1
server 10.53.0.1 ${PORT}
ttl 600
......@@ -278,10 +279,12 @@ now=`$PERL -e 'print time()."\n";'`
sleep 1
$DIG $DIGOPTS +short unixtime.nil. soa @10.53.0.1 > dig.out.new.test$n || ret=1
serial=`awk '{print $3}' dig.out.new.test$n` || ret=1
[ "$oldserial" -ne "$serial" ] || ret=1
# allow up to 2 seconds difference between the serial
# number and the unix epoch date but no more
$PERL -e 'exit 1 if abs($ARGV[1] - $ARGV[0]) > 2;' $now $serial || ret=1
[ "$oldserial" = "$serial" ] && { echo_i "oldserial == serial"; ret=1; }
if [ "$serial" -lt "$start" ]; then
echo_i "out-of-range serial=$serial < start=$start"; ret=1;
elif [ "$serial" -gt "$now" ]; then
echo_i "out-of-range serial=$serial > now=$now"; ret=1;
fi
[ $ret = 0 ] || { echo_i "failed"; status=1; }
ret=0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment