tests.sh revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
#
# Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# $Id: tests.sh,v 1.4.154.1 2012/01/04 20:05:03 smann Exp $
DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd"
status=0
n=0
n=`expr $n + 1`
echo "I:preparing ($n)"
ret=0
server 10.53.0.2
zone nil.
update add text1.nil. 600 IN TXT "addition 1"
send
zone other.
update add text1.other. 600 IN TXT "addition 1"
send
END
echo "I:rndc freeze"
n=`expr $n + 1`
echo "I:checking zone was dumped ($n)"
ret=0
n=`expr $n + 1`
echo "I:checking journal file is still present ($n)"
ret=0
n=`expr $n + 1`
echo "I:checking zone not writable ($n)"
ret=0
server 10.53.0.2
zone nil.
update add text2.nil. 600 IN TXT "addition 2"
send
END
echo "I:rndc thaw"
n=`expr $n + 1`
echo "I:checking zone now writable ($n)"
ret=0
server 10.53.0.2
zone nil.
update add text3.nil. 600 IN TXT "addition 3"
send
END
echo "I:rndc sync"
ret=0
n=`expr $n + 1`
echo "I:checking zone was dumped ($n)"
ret=0
n=`expr $n + 1`
echo "I:checking journal file is still present ($n)"
ret=0
n=`expr $n + 1`
echo "I:checking zone is still writable ($n)"
ret=0
server 10.53.0.2
zone nil.
update add text4.nil. 600 IN TXT "addition 4"
send
END
echo "I:rndc sync -clean"
ret=0
n=`expr $n + 1`
echo "I:checking zone was dumped ($n)"
ret=0
n=`expr $n + 1`
echo "I:checking journal file is deleted ($n)"
ret=0
n=`expr $n + 1`
echo "I:checking zone is still writable ($n)"
ret=0
server 10.53.0.2
zone nil.
update add text5.nil. 600 IN TXT "addition 5"
send
END
n=`expr $n + 1`
echo "I:checking other journal files not removed ($n)"
ret=0
echo "I:cleaning all zones ($n)"
n=`expr $n + 1`
echo "I:checking all journals removed ($n)"
ret=0
n=`expr $n + 1`
echo "I:checking that freezing static zones is not allowed ($n)"
ret=0
n=`expr $n + 1`
echo "I:checking that journal is removed when serial is changed before thaw ($n)"
ret=0
sleep 1
server 10.53.0.2
zone other.
update add text6.other. 600 IN TXT "addition 6"
send
END
sleep 1
server 10.53.0.2
zone other.
update add text7.other. 600 IN TXT "addition 7"
send
END
n=`expr $n + 1`
echo "I:checking that journal is kept when ixfr-from-differences is in use ($n)"
ret=0
server 10.53.0.2
zone nil.
update add text6.nil. 600 IN TXT "addition 6"
send
END
sleep 1
server 10.53.0.2
zone nil.
update add text7.nil. 600 IN TXT "addition 7"
send
END
# temp test
echo "I:dumping stats ($n)"
n=`expr $n + 1`
echo "I: verifying adb records in named.stats ($n)"
n=`expr $n + 1`
echo "I:test using second key ($n)"
ret=0
n=`expr $n + 1`
echo "I:test 'rndc dumpdb' on a empty cache ($n)"
ret=0
do
tmp=0
sleep 1
done
n=`expr $n + 1`
echo "I:test 'rndc reload' on a zone with include files ($n)"
ret=0
do
tmp=0
sleep 1
done
do
tmp=0
sleep 1
done
n=`expr $n + 1`
echo "I:testing rndc with hmac-md5 ($n)"
ret=0
do
done
n=`expr $n + 1`
echo "I:testing rndc with hmac-sha1 ($n)"
ret=0
do
done
n=`expr $n + 1`
echo "I:testing rndc with hmac-sha224 ($n)"
ret=0
do
done
n=`expr $n + 1`
echo "I:testing rndc with hmac-sha256 ($n)"
ret=0
do
done
n=`expr $n + 1`
echo "I:testing rndc with hmac-sha384 ($n)"
ret=0
do
done
n=`expr $n + 1`
echo "I:testing rndc with hmac-sha512 ($n)"
ret=0
do
done
n=`expr $n + 1`
echo "I:testing automatic zones are reported ($n)"
ret=0
n=`expr $n + 1`
echo "I:testing rndc with null command ($n)"
ret=0
n=`expr $n + 1`
echo "I:testing rndc with unknown control channel command ($n)"
ret=0
# rndc: 'obviouslynotacommand' failed: unknown command
n=`expr $n + 1`
echo "I:testing rndc with querylog command ($n)"
ret=0
# first enable it with querylog on option
# query for builtin and check if query was logged
# toggle query logging and check again
# query for another builtin zone and check if query was logged
n=`expr $n + 1`
echo "I:testing rndc nta time limits ($n)"
ret=0
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf nta -l 2h nta1.example 2>&1 | grep "Negative trust anchor added" > /dev/null || ret=1
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf nta -l 1d nta2.example 2>&1 | grep "Negative trust anchor added" > /dev/null || ret=1
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf nta -l 1w nta3.example 2>&1 | grep "Negative trust anchor added" > /dev/null || ret=1
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf nta -l 8d nta4.example 2>&1 | grep "NTA lifetime cannot exceed one week" > /dev/null || ret=1
do
n=`expr $n + 1`
echo "I:testing rndc buffer size limits (size=${i}) ($n)"
ret=0
if [ "$?" = "0" ]; then
expected_size=`expr $i + 1`
else
ret=1
fi
done
n=`expr $n + 1`
echo "I:testing rndc -r (show result) ($n)"
ret=0
n=`expr $n + 1`
echo "I:testing rndc with a token containing a space ($n)"
ret=0
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf -r flush '"view with a space"' 2>&1 > rndc.output.test$n || ret=1
n=`expr $n + 1`
echo "I:test 'rndc reconfig' with a broken config ($n)"
ret=0
sleep 1
sleep 1
sleep 1
n=`expr $n + 1`
echo "I:test read-only control channel access ($n)"
ret=0
n=`expr $n + 1`
echo "I:test rndc status shows running on ($n)"
ret=0
n=`expr $n + 1`
echo "I:test 'rndc reconfig' with loading of a large zone ($n)"
ret=0
echo " I:reloading config"
sleep 1
n=`expr $n + 1`
echo " I:check if zone load was scheduled ($n)"
n=`expr $n + 1`
echo " I:check if query for the zone returns SERVFAIL ($n)"
n=`expr $n + 1`
echo " I:wait for the zones to be loaded ($n)"
ret=1
try=0
do
sleep 1
sed -n "$cur,"'$p' < ns6/named.run | grep "any newly configured zones are now loaded" > /dev/null && {
ret=0
break
}
done
n=`expr $n + 1`
echo " I:check if query for the zone returns NOERROR ($n)"
n=`expr $n + 1`
echo "I:verify that the full command is logged ($n)"
ret=0
grep "received control channel command 'null with extra arguments'" ns2/named.run > /dev/null || ret=1
sleep 1
sleep 1
if [ -x "$PYTHON" ]; then
n=`expr $n + 1`
echo "I:test rndc python bindings ($n)"
ret=0
$PYTHON > rndc.output.test$n << EOF
import sys
sys.path.insert(0, '../../../../bin/python')
from isc import *
r = rndc(('10.53.0.5', 9953), 'hmac-sha256', '1234abcd8765')
result = r.call('status')
print(result['text'])
EOF
fi
echo "I:exit status: $status"