2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 18:19:42 +00:00

217 lines
6.9 KiB
Bash
Raw Normal View History

2000-05-19 18:01:27 +00:00
#!/bin/sh
2000-05-19 22:45:47 +00:00
#
2016-02-02 23:45:23 +00:00
# Copyright (C) 2004, 2007, 2011-2016 Internet Systems Consortium, Inc. ("ISC")
2012-06-29 11:39:47 +10:00
# Copyright (C) 2000, 2001 Internet Software Consortium.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
2004-03-05 05:14:21 +00:00
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
2000-05-19 18:01:27 +00:00
status=0
n=0
#
# Wait up to 10 seconds for the servers to finish starting before testing.
#
2011-10-14 12:02:12 +00:00
for i in 1 2 3 4 5 6 7 8 9 10
do
ret=0
$DIG +tcp example @10.53.0.2 soa -p 5300 > dig.out.ns2.test$n || ret=1
grep "status: NOERROR" dig.out.ns2.test$n > /dev/null || ret=1
grep "flags:.* aa[ ;]" dig.out.ns2.test$n > /dev/null || ret=1
$DIG +tcp example @10.53.0.3 soa -p 5300 > dig.out.ns3.test$n || ret=1
grep "status: NOERROR" dig.out.ns3.test$n > /dev/null || ret=1
grep "flags:.* aa[ ;]" dig.out.ns3.test$n > /dev/null || ret=1
nr=`grep 'x[0-9].*sending notify to' ns2/named.run | wc -l`
[ $nr -eq 20 ] || ret=1
2011-10-14 12:02:12 +00:00
[ $ret = 0 ] && break
sleep 1
done
n=`expr $n + 1`
echo "I:checking initial status ($n)"
ret=0
$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
@10.53.0.2 a -p 5300 > dig.out.ns2.test$n || ret=1
grep "10.0.0.1" dig.out.ns2.test$n > /dev/null || ret=1
2000-05-19 18:01:27 +00:00
$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
@10.53.0.3 a -p 5300 > dig.out.ns3.test$n || ret=1
grep "10.0.0.1" dig.out.ns3.test$n > /dev/null || ret=1
2000-05-19 18:01:27 +00:00
$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns3.test$n || ret=1
2000-05-19 18:01:27 +00:00
[ $ret = 0 ] || echo "I:failed"
status=`expr $ret + $status`
n=`expr $n + 1`
echo "I:checking startup notify rate limit ($n)"
ret=0
grep 'x[0-9].*sending notify to' ns2/named.run |
sed 's/.*:\([0-9][0-9]\)\..*/\1/' | uniq -c | awk '{print $1}' > log.out
# the notifies should span at least 4 seconds
wc -l log.out | awk '$1 < 4 { exit(1) }' || ret=1
# ... with no more than 5 in any one second
awk '$1 > 5 { exit(1) }' log.out || ret=1
[ $ret = 0 ] || echo "I:failed"
status=`expr $ret + $status`
echo "I:reloading with example2 using HUP and waiting up to 45 seconds"
sleep 1 # make sure filesystem time stamp is newer for reload.
rm -f ns2/example.db
cp -f ns2/example2.db ns2/example.db
2000-05-19 18:01:27 +00:00
kill -HUP `cat ns2/named.pid`
try=0
while test $try -lt 45
do
sleep 1
grep 'notify from 10.53.0.2#[0-9][0-9]*: serial 2$' ns3/named.run > /dev/null && break
try=`expr $try + 1`
done
2000-05-19 18:01:27 +00:00
n=`expr $n + 1`
echo "I:checking notify message was logged ($n)"
ret=0
grep 'notify from 10.53.0.2#[0-9][0-9]*: serial 2$' ns3/named.run > /dev/null || ret=1
[ $ret = 0 ] || echo "I:failed"
status=`expr $ret + $status`
n=`expr $n + 1`
echo "I:checking example2 loaded ($n)"
ret=0
$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
@10.53.0.2 a -p 5300 > dig.out.ns2.test$n || ret=1
grep "10.0.0.2" dig.out.ns2.test$n > /dev/null || ret=1
[ $ret = 0 ] || echo "I:failed"
status=`expr $ret + $status`
2000-05-19 18:01:27 +00:00
n=`expr $n + 1`
echo "I:checking example2 contents have been transferred after HUP reload ($n)"
ret=0
$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
@10.53.0.2 a -p 5300 > dig.out.ns2.test$n || ret=1
grep "10.0.0.2" dig.out.ns2.test$n > /dev/null || ret=1
2000-05-19 18:01:27 +00:00
$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
@10.53.0.3 a -p 5300 > dig.out.ns3.test$n || ret=1
grep "10.0.0.2" dig.out.ns3.test$n > /dev/null || ret=1
$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns3.test$n || ret=1
2000-05-19 18:01:27 +00:00
[ $ret = 0 ] || echo "I:failed"
status=`expr $ret + $status`
2000-05-19 18:01:27 +00:00
echo "I:stopping master and restarting with example4 then waiting up to 45 seconds"
$PERL $SYSTEMTESTTOP/stop.pl . ns2
rm -f ns2/example.db
cp -f ns2/example4.db ns2/example.db
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns2
try=0
while test $try -lt 45
do
sleep 1
grep 'notify from 10.53.0.2#[0-9][0-9]*: serial 4$' ns3/named.run > /dev/null && break
try=`expr $try + 1`
done
2000-05-19 18:01:27 +00:00
n=`expr $n + 1`
echo "I:checking notify message was logged ($n)"
ret=0
grep 'notify from 10.53.0.2#[0-9][0-9]*: serial 4$' ns3/named.run > /dev/null || ret=1
[ $ret = 0 ] || echo "I:failed"
status=`expr $ret + $status`
n=`expr $n + 1`
echo "I:checking example4 loaded ($n)"
ret=0
$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
@10.53.0.2 a -p 5300 > dig.out.ns2.test$n || ret=1
grep "10.0.0.4" dig.out.ns2.test$n > /dev/null || ret=1
[ $ret = 0 ] || echo "I:failed"
status=`expr $ret + $status`
n=`expr $n + 1`
echo "I:checking example4 contents have been transfered after restart ($n)"
ret=0
$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
@10.53.0.2 a -p 5300 > dig.out.ns2.test$n || ret=1
grep "10.0.0.4" dig.out.ns2.test$n > /dev/null || ret=1
2000-05-19 18:01:27 +00:00
$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd a.example.\
@10.53.0.3 a -p 5300 > dig.out.ns3.test$n || ret=1
grep "10.0.0.4" dig.out.ns3.test$n > /dev/null || ret=1
$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns3.test$n || ret=1
2000-05-19 18:01:27 +00:00
[ $ret = 0 ] || echo "I:failed"
status=`expr $ret + $status`
2000-05-19 18:01:27 +00:00
n=`expr $n + 1`
echo "I:checking notify to alternate port with master inheritance"
$NSUPDATE << EOF
server 10.53.0.2 5300
zone x21
update add added.x21 0 in txt "test string"
send
EOF
for i in 1 2 3 4 5 6 7 8 9
do
$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd added.x21.\
@10.53.0.4 txt -p 5301 > dig.out.ns4.test$n || ret=1
grep "test string" dig.out.ns4.test$n > /dev/null && break
sleep 1
done
grep "test string" dig.out.ns4.test$n > /dev/null || ret=1
[ $ret = 0 ] || echo "I:failed"
status=`expr $ret + $status`
n=`expr $n + 1`
echo "I:checking notify to multiple views using tsig"
ret=0
$NSUPDATE << EOF
server 10.53.0.5 5300
zone x21
key a aaaaaaaaaaaaaaaaaaaa
update add added.x21 0 in txt "test string"
send
EOF
for i in 1 2 3 4 5 6 7 8 9
do
$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd added.x21.\
-y b:bbbbbbbbbbbbbbbbbbbb @10.53.0.5 \
txt -p 5300 > dig.out.b.ns5.test$n || ret=1
$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd added.x21.\
-y c:cccccccccccccccccccc @10.53.0.5 \
txt -p 5300 > dig.out.c.ns5.test$n || ret=1
grep "test string" dig.out.b.ns5.test$n > /dev/null &&
grep "test string" dig.out.c.ns5.test$n > /dev/null &&
break
sleep 1
done
grep "test string" dig.out.b.ns5.test$n > /dev/null || ret=1
grep "test string" dig.out.c.ns5.test$n > /dev/null || ret=1
[ $ret = 0 ] || echo "I:failed"
status=`expr $ret + $status`
2000-07-07 18:25:20 +00:00
echo "I:exit status: $status"
[ $status -eq 0 ] || exit 1