4522. [bug] Handle big gaps in log file version numbers better.

[RT #38688]
This commit is contained in:
Mark Andrews
2016-11-30 10:55:21 +11:00
parent 1d7d7cdcda
commit cab871f1bc
7 changed files with 240 additions and 52 deletions

View File

@@ -18,6 +18,8 @@ SYMCONF="${THISDIR}/${CONFDIR}/named.symconf"
PLAINCONF="${THISDIR}/${CONFDIR}/named.plainconf"
ISOCONF="${THISDIR}/${CONFDIR}/named.iso8601"
ISOCONFUTC="${THISDIR}/${CONFDIR}/named.iso8601-utc"
VERSCONF="${THISDIR}/${CONFDIR}/named.versconf"
UNLIMITEDCONF="${THISDIR}/${CONFDIR}/named.unlimited"
PLAINFILE="named_log"
DIRFILE="named_dir"
PIPEFILE="named_pipe"
@@ -25,6 +27,8 @@ SYMFILE="named_sym"
DLFILE="named_deflog"
ISOFILE="named_iso8601"
ISOUTCFILE="named_iso8601_utc"
VERSFILE="named_vers"
UNLIMITEDFILE="named_unlimited"
PIDFILE="${THISDIR}/${CONFDIR}/named.pid"
myRNDC="$RNDC -c ${THISDIR}/${CONFDIR}/rndc.conf"
myNAMED="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record,size,mctx -T clienttest -T nosyslog -d 99 -X named.lock -U 4"
@@ -278,10 +282,10 @@ echo "I: testing iso8601 timestamp ($n)"
cp $ISOCONF named.conf
$myRNDC reconfig > rndc.out.test$n 2>&1
if grep '^....-..-..T..:..:..\.... ' $ISOFILE > /dev/null; then
echo "I: testing iso8601 timestamp succeeded"
echo "I: testing iso8601 timestamp succeeded"
else
echo "I: testing iso8601 timestamp failed"
status=`expr $status + 1`
echo "I: testing iso8601 timestamp failed"
status=`expr $status + 1`
fi
n=`expr $n + 1`
@@ -289,10 +293,77 @@ echo "I: testing iso8601-utc timestamp ($n)"
cp $ISOCONFUTC named.conf
$myRNDC reconfig > rndc.out.test$n 2>&1
if grep '^....-..-..T..:..:..\....Z' $ISOUTCFILE > /dev/null; then
echo "I: testing iso8601-utc timestamp succeeded"
echo "I: testing iso8601-utc timestamp succeeded"
else
echo "I: testing iso8601-utc timestamp failed"
status=`expr $status + 1`
echo "I: testing iso8601-utc timestamp failed"
status=`expr $status + 1`
fi
n=`expr $n + 1`
echo "I: testing explict versions ($n)"
cp $VERSCONF named.conf
# a seconds since epoch version number
touch $VERSFILE.1480039317
t1=`$PERL -e 'print time()."\n";'`
$myRNDC reconfig > rndc.out.test$n 2>&1
$DIG version.bind txt ch @10.53.0.1 -p 5300 > dig.out.test$n
t2=`$PERL -e 'print time()."\n";'`
t=`expr ${t2:-0} - ${t1:-0}`
if test ${t:-1000} -gt 1
then
echo "I: testing explict versions failed cleanup of old entries took too long"
status=`expr $status + 1`
fi
if ! grep "status: NOERROR" dig.out.test$n > /dev/null
then
echo "I: testing explict versions failed DiG lookup failed"
status=`expr $status + 1`
fi
if test -f $VERSFILE.1480039317
then
echo "I: testing explict versions failed $VERSFILE.1480039317 not removed"
status=`expr $status + 1`
fi
if test -f $VERSFILE.5
then
echo "I: testing explict versions failed $VERSFILE.5 exists"
status=`expr $status + 1`
fi
if test ! -f $VERSFILE.4
then
echo "I: testing explict versions failed $VERSFILE.4 does not exist"
status=`expr $status + 1`
fi
n=`expr $n + 1`
echo "I: testing unlimited versions ($n)"
cp $UNLIMITEDCONF named.conf
# a seconds since epoch version number
touch $UNLIMITEDFILE.1480039317
t1=`$PERL -e 'print time()."\n";'`
$myRNDC reconfig > rndc.out.test$n 2>&1
$DIG version.bind txt ch @10.53.0.1 -p 5300 > dig.out.test$n
t2=`$PERL -e 'print time()."\n";'`
t=`expr ${t2:-0} - ${t1:-0}`
if test ${t:-1000} -gt 1
then
echo "I: testing unlimited versions failed took too long"
status=`expr $status + 1`
fi
if ! grep "status: NOERROR" dig.out.test$n > /dev/null
then
echo "I: testing unlimited versions failed DiG lookup failed"
status=`expr $status + 1`
fi
if test ! -f $UNLIMITEDFILE.1480039317
then
echo "I: testing unlimited versions failed $UNLIMITEDFILE.1480039317 removed"
status=`expr $status + 1`
fi
if test ! -f $UNLIMITEDFILE.5
then
echo "I: testing unlimited versions failed $UNLIMITEDFILE.5 does not"
status=`expr $status + 1`
fi
echo "I:exit status: $status"