Commit 31f4fb98 authored by Mark Andrews's avatar Mark Andrews
Browse files

4617. [test] Update rndc system test to be more delay tolerant.

                        [RT #45177]
parent f9d602f3
4617. [test] Update rndc system test to be more delay tolerant.
[RT #45177]
4616. [bug] When using LMDB, zones deleted using "rndc delzone"
were not correctly removed from the new-zone
database. [RT #45185]
......
......@@ -6,17 +6,18 @@
# 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/.
rm -f dig.out.*.test*
rm -f ns*/named.lock
rm -f ns*/named.memstats
rm -f ns*/named.run
rm -f ns2/named.stats
rm -f ns2/nil.db ns2/other.db ns2/static.db ns2/*.jnl
rm -f ns2/session.key
rm -f ns2/named.stats
rm -f ns3/named_dump.db
rm -f ns*/named.memstats
rm -f ns*/named.run
rm -f ns4/*.conf
rm -f rndc.status
rm -f rndc.output.test*
rm -f dig.out.test*
rm -f ns*/named.lock
rm -f ns4/*.nta
rm -f ns6/named.conf
rm -f ns6/huge.zone.db
rm -f ns6/named.conf
rm -f nsupdate.out.*.test*
rm -f python.out.*.test*
rm -f rndc.out.*.test*
......@@ -30,8 +30,12 @@ zone other.
update add text1.other. 600 IN TXT "addition 1"
send
END
[ -s ns2/nil.db.jnl ] || ret=1
[ -s ns2/other.db.jnl ] || ret=1
[ -s ns2/nil.db.jnl ] || {
echo "I: 'test -s ns2/nil.db.jnl' failed when it shouldn't have"; ret=1;
}
[ -s ns2/other.db.jnl ] || {
echo "I: 'test -s ns2/other.db.jnl' failed when it shouldn't have"; ret=1;
}
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -41,6 +45,11 @@ $RNDCCMD freeze | sed 's/^/I:ns2 /'
n=`expr $n + 1`
echo "I:checking zone was dumped ($n)"
ret=0
for i in 1 2 3 4 5 6 7 8 9 10
do
grep "addition 1" ns2/nil.db > /dev/null && break
sleep 1
done
grep "addition 1" ns2/nil.db > /dev/null 2>&1 || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -48,7 +57,9 @@ status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:checking journal file is still present ($n)"
ret=0
[ -s ns2/nil.db.jnl ] || ret=1
[ -s ns2/nil.db.jnl ] || {
echo "I: 'test -s ns2/nil.db.jnl' failed when it shouldn't have"; ret=1;
}
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -62,7 +73,8 @@ update add text2.nil. 600 IN TXT "addition 2"
send
END
$DIGCMD text2.nil. TXT | grep 'addition 2' >/dev/null && ret=1
$DIGCMD text2.nil. TXT > dig.out.1.test$n
grep 'addition 2' dig.out.1.test$n >/dev/null && ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -72,13 +84,14 @@ $RNDCCMD thaw | sed 's/^/I:ns2 /'
n=`expr $n + 1`
echo "I:checking zone now writable ($n)"
ret=0
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
$NSUPDATE -p 5300 -k ns2/session.key > nsupdate.out.1.test$n 2>&1 <<END || ret=1
server 10.53.0.2
zone nil.
update add text3.nil. 600 IN TXT "addition 3"
send
END
$DIGCMD text3.nil. TXT | grep 'addition 3' >/dev/null || ret=1
$DIGCMD text3.nil. TXT > dig.out.1.test$n
grep 'addition 3' dig.out.1.test$n >/dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -89,6 +102,11 @@ $RNDCCMD sync nil | sed 's/^/I:ns2 /'
n=`expr $n + 1`
echo "I:checking zone was dumped ($n)"
ret=0
for i in 1 2 3 4 5 6 7 8 9 10
do
grep "addition 3" ns2/nil.db > /dev/null && break
sleep 1
done
grep "addition 3" ns2/nil.db > /dev/null 2>&1 || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -96,21 +114,24 @@ status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:checking journal file is still present ($n)"
ret=0
[ -s ns2/nil.db.jnl ] || ret=1
[ -s ns2/nil.db.jnl ] || {
echo "I: 'test -s ns2/nil.db.jnl' failed when it shouldn't have"; ret=1;
}
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:checking zone is still writable ($n)"
ret=0
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
$NSUPDATE -p 5300 -k ns2/session.key > nsupdate.out.1.test$n 2>&1 <<END || ret=1
server 10.53.0.2
zone nil.
update add text4.nil. 600 IN TXT "addition 4"
send
END
$DIGCMD text4.nil. TXT | grep 'addition 4' >/dev/null || ret=1
$DIGCMD text4.nil. TXT > dig.out.1.test$n
grep 'addition 4' dig.out.1.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -121,6 +142,11 @@ $RNDCCMD sync -clean nil | sed 's/^/I:ns2 /'
n=`expr $n + 1`
echo "I:checking zone was dumped ($n)"
ret=0
for i in 1 2 3 4 5 6 7 8 9 10
do
grep "addition 4" ns2/nil.db > /dev/null && break
sleep 1
done
grep "addition 4" ns2/nil.db > /dev/null 2>&1 || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -128,7 +154,9 @@ status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:checking journal file is deleted ($n)"
ret=0
[ -s ns2/nil.db.jnl ] && ret=1
[ -s ns2/nil.db.jnl ] && {
echo "I: 'test -s ns2/nil.db.jnl' failed when it shouldn't have"; ret=1;
}
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -142,14 +170,17 @@ update add text5.nil. 600 IN TXT "addition 5"
send
END
$DIGCMD text4.nil. TXT | grep 'addition 4' >/dev/null || ret=1
$DIGCMD text4.nil. TXT > dig.out.1.test$n
grep 'addition 4' dig.out.1.test$n >/dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:checking other journal files not removed ($n)"
ret=0
[ -s ns2/other.db.jnl ] || ret=1
[ -s ns2/other.db.jnl ] || {
echo "I: 'test -s ns2/other.db.jnl' failed when it shouldn't have"; ret=1;
}
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -159,15 +190,20 @@ $RNDCCMD sync -clean | sed 's/^/I:ns2 /'
n=`expr $n + 1`
echo "I:checking all journals removed ($n)"
ret=0
[ -s ns2/nil.db.jnl ] && ret=1
[ -s ns2/other.db.jnl ] && ret=1
[ -s ns2/nil.db.jnl ] && {
echo "I: 'test -s ns2/nil.db.jnl' succeeded when it shouldn't have"; ret=1;
}
[ -s ns2/other.db.jnl ] && {
echo "I: 'test -s ns2/other.db.jnl' succeeded when it shouldn't have"; ret=1;
}
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:checking that freezing static zones is not allowed ($n)"
ret=0
$RNDCCMD freeze static 2>&1 | grep 'not dynamic' > /dev/null || ret=1
$RNDCCMD freeze static > rndc.out.1.test$n 2>&1
grep 'not dynamic' rndc.out.1.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -175,14 +211,21 @@ n=`expr $n + 1`
echo "I:checking that journal is removed when serial is changed before thaw ($n)"
ret=0
sleep 1
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
$NSUPDATE -p 5300 -k ns2/session.key > nsupdate.out.1.test$n 2>&1 <<END || ret=1
server 10.53.0.2
zone other.
update add text6.other. 600 IN TXT "addition 6"
send
END
[ -s ns2/other.db.jnl ] || ret=1
[ -s ns2/other.db.jnl ] || {
echo "I: 'test -s ns2/other.db.jnl' failed when it shouldn't have"; ret=1;
}
$RNDCCMD freeze other 2>&1 | sed 's/^/I:ns2 /'
for i in 1 2 3 4 5 6 7 8 9 10
do
grep "addition 6" ns2/other.db > /dev/null && break
sleep 1
done
serial=`awk '$3 == "serial" {print $1}' ns2/other.db`
newserial=`expr $serial + 1`
sed s/$serial/$newserial/ ns2/other.db > ns2/other.db.new
......@@ -190,30 +233,42 @@ echo 'frozen TXT "frozen addition"' >> ns2/other.db.new
mv -f ns2/other.db.new ns2/other.db
$RNDCCMD thaw 2>&1 | sed 's/^/I:ns2 /'
sleep 1
[ -f ns2/other.db.jnl ] && ret=1
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
[ -f ns2/other.db.jnl ] && {
echo "I: 'test -f ns2/other.db.jnl' succeeded when it shouldn't have"; ret=1;
}
$NSUPDATE -p 5300 -k ns2/session.key > nsupdate.out.2.test$n 2>&1 <<END || ret=1
server 10.53.0.2
zone other.
update add text7.other. 600 IN TXT "addition 7"
send
END
$DIGCMD text6.other. TXT | grep 'addition 6' >/dev/null || ret=1
$DIGCMD text7.other. TXT | grep 'addition 7' >/dev/null || ret=1
$DIGCMD frozen.other. TXT | grep 'frozen addition' >/dev/null || ret=1
$DIGCMD text6.other. TXT > dig.out.1.test$n
grep 'addition 6' dig.out.1.test$n >/dev/null || ret=1
$DIGCMD text7.other. TXT > dig.out.2.test$n
grep 'addition 7' dig.out.2.test$n >/dev/null || ret=1
$DIGCMD frozen.other. TXT > dig.out.3.test$n
grep 'frozen addition' dig.out.3.test$n >/dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:checking that journal is kept when ixfr-from-differences is in use ($n)"
ret=0
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
$NSUPDATE -p 5300 -k ns2/session.key > nsupdate.out.1.test$n 2>&1 <<END || ret=1
server 10.53.0.2
zone nil.
update add text6.nil. 600 IN TXT "addition 6"
send
END
[ -s ns2/nil.db.jnl ] || ret=1
[ -s ns2/nil.db.jnl ] || {
echo "I: 'test -s ns2/nil.db.jnl' failed when it shouldn't have"; ret=1;
}
$RNDCCMD freeze nil 2>&1 | sed 's/^/I:ns2 /'
for i in 1 2 3 4 5 6 7 8 9 10
do
grep "addition 6" ns2/nil.db > /dev/null && break
sleep 1
done
serial=`awk '$3 == "serial" {print $1}' ns2/nil.db`
newserial=`expr $serial + 1`
sed s/$serial/$newserial/ ns2/nil.db > ns2/nil.db.new
......@@ -221,16 +276,21 @@ echo 'frozen TXT "frozen addition"' >> ns2/nil.db.new
mv -f ns2/nil.db.new ns2/nil.db
$RNDCCMD thaw 2>&1 | sed 's/^/I:ns2 /'
sleep 1
[ -s ns2/nil.db.jnl ] || ret=1
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
[ -s ns2/nil.db.jnl ] || {
echo "I: 'test -s ns2/nil.db.jnl' failed when it shouldn't have"; ret=1;
}
$NSUPDATE -p 5300 -k ns2/session.key > nsupdate.out.2.test$n 2>&1 <<END || ret=1
server 10.53.0.2
zone nil.
update add text7.nil. 600 IN TXT "addition 7"
send
END
$DIGCMD text6.nil. TXT | grep 'addition 6' >/dev/null || ret=1
$DIGCMD text7.nil. TXT | grep 'addition 7' >/dev/null || ret=1
$DIGCMD frozen.nil. TXT | grep 'frozen addition' >/dev/null || ret=1
$DIGCMD text6.nil. TXT > dig.out.1.test$n
grep 'addition 6' dig.out.1.test$n > /dev/null || ret=1
$DIGCMD text7.nil. TXT > dig.out.2.test$n
grep 'addition 7' dig.out.2.test$n > /dev/null || ret=1
$DIGCMD frozen.nil. TXT > dig.out.3.test$n
grep 'frozen addition' dig.out.3.test$n >/dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -363,8 +423,8 @@ status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:testing automatic zones are reported ($n)"
ret=0
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf status > rndc.output.test$n || ret=1
grep "number of zones: 198 (196 automatic)" rndc.output.test$n > /dev/null || ret=1
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf status > rndc.out.1.test$n || ret=1
grep "number of zones: 198 (196 automatic)" rndc.out.1.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -410,13 +470,18 @@ grep "query: foo9876.bind CH TXT.*(.*)$" ns4/named.run > /dev/null && ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
RNDCCMD4="$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf"
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
$RNDCCMD4 nta -l 2h nta1.example > rndc.out.1.test$n 2>&1
grep "Negative trust anchor added" rndc.out.1.test$n > /dev/null || ret=1
$RNDCCMD4 nta -l 1d nta2.example > rndc.out.2.test$n 2>&1
grep "Negative trust anchor added" rndc.out.2.test$n > /dev/null || ret=1
$RNDCCMD4 nta -l 1w nta3.example > rndc.out.3.test$n 2>&1
grep "Negative trust anchor added" rndc.out.3.test$n > /dev/null || ret=1
$RNDCCMD4 nta -l 8d nta4.example > rndc.out.4.test$n 2>&1
grep "NTA lifetime cannot exceed one week" rndc.out.4.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -425,8 +490,8 @@ do
n=`expr $n + 1`
echo "I:testing rndc buffer size limits (size=${i}) ($n)"
ret=0
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf testgen ${i} 2>&1 > rndc.output.test$n || ret=1
actual_size=`$GENCHECK rndc.output.test$n`
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf testgen ${i} 2>&1 > rndc.out.$i.test$n || ret=1
actual_size=`$GENCHECK rndc.out.$i.test$n`
if [ "$?" = "0" ]; then
expected_size=`expr $i + 1`
if [ $actual_size != $expected_size ]; then ret=1; fi
......@@ -441,16 +506,16 @@ done
n=`expr $n + 1`
echo "I:testing rndc -r (show result) ($n)"
ret=0
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf -r testgen 0 2>&1 > rndc.output.test$n || ret=1
grep "ISC_R_SUCCESS 0" rndc.output.test$n > /dev/null || ret=1
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf -r testgen 0 2>&1 > rndc.out.1.test$n || ret=1
grep "ISC_R_SUCCESS 0" rndc.out.1.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
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
grep "not found" rndc.output.test$n > /dev/null && ret=1
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf -r flush '"view with a space"' 2>&1 > rndc.out.1.test$n || ret=1
grep "not found" rndc.out.1.test$n > /dev/null && ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -461,8 +526,8 @@ $RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > /dev/null || ret=1
sleep 1
mv ns4/named.conf ns4/named.conf.save
echo "error error error" >> ns4/named.conf
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > rndc.output.test$n 2>&1 && ret=1
grep "rndc: 'reconfig' failed: unexpected token" rndc.output.test$n > /dev/null || ret=1
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > rndc.out.1.test$n 2>&1 && ret=1
grep "rndc: 'reconfig' failed: unexpected token" rndc.out.1.test$n > /dev/null || ret=1
mv ns4/named.conf.save ns4/named.conf
sleep 1
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > /dev/null || ret=1
......@@ -482,8 +547,8 @@ status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:test rndc status shows running on ($n)"
ret=0
$RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf status > rndc.output.test$n 2>&1 || ret=1
grep "^running on " rndc.output.test$n > /dev/null || ret=1
$RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf status > rndc.out.1.test$n 2>&1 || ret=1
grep "^running on " rndc.out.1.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......@@ -494,7 +559,7 @@ cur=`awk 'BEGIN {l=0} /^/ {l++} END { print l }' ns6/named.run`
cp ns6/named.conf ns6/named.conf.save
echo "zone \"huge.zone\" { type master; file \"huge.zone.db\"; };" >> ns6/named.conf
echo " I:reloading config"
$RNDC -s 10.53.0.6 -p 9953 -c ../common/rndc.conf reconfig > rndc.output.test$n 2>&1 || ret=1
$RNDC -s 10.53.0.6 -p 9953 -c ../common/rndc.conf reconfig > rndc.out.1.test$n 2>&1 || ret=1
if [ $ret != 0 ]; then echo " I:failed"; fi
status=`expr $status + $ret`
sleep 1
......@@ -506,8 +571,8 @@ status=`expr $status + $ret`
n=`expr $n + 1`
echo " I:check if query for the zone returns SERVFAIL ($n)"
$DIG @10.53.0.6 -p 5300 -t soa huge.zone > dig.out.test$n
grep "SERVFAIL" dig.out.test$n > /dev/null || ret=1
$DIG @10.53.0.6 -p 5300 -t soa huge.zone > dig.out.1.test$n
grep "SERVFAIL" dig.out.1.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo " I:failed (ignored)"; ret=0; fi
status=`expr $status + $ret`
......@@ -529,8 +594,8 @@ status=`expr $status + $ret`
n=`expr $n + 1`
echo " I:check if query for the zone returns NOERROR ($n)"
$DIG @10.53.0.6 -p 5300 -t soa huge.zone > dig.out.test$n
grep "NOERROR" dig.out.test$n > /dev/null || ret=1
$DIG @10.53.0.6 -p 5300 -t soa huge.zone > dig.out.1.test$n
grep "NOERROR" dig.out.1.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo " I:failed"; fi
status=`expr $status + $ret`
......@@ -553,7 +618,7 @@ if [ -x "$PYTHON" ]; then
n=`expr $n + 1`
echo "I:test rndc python bindings ($n)"
ret=0
$PYTHON > rndc.output.test$n << EOF
$PYTHON > python.out.1.test$n << EOF
import sys
sys.path.insert(0, '../../../../bin/python')
from isc import *
......@@ -561,7 +626,7 @@ r = rndc(('10.53.0.5', 9953), 'hmac-sha256', '1234abcd8765')
result = r.call('status')
print(result['text'])
EOF
grep 'server is up and running' rndc.output.test$n > /dev/null 2>&1 || ret=1
grep 'server is up and running' python.out.1.test$n > /dev/null 2>&1 || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
fi
......@@ -569,8 +634,8 @@ fi
n=`expr $n + 1`
echo "I:check 'rndc \"\"' is handled ($n)"
ret=0
$RNDCCMD "" > rndc.output.test$n 2>&1 && ret=1
grep "rndc: '' failed: failure" rndc.output.test$n > /dev/null
$RNDCCMD "" > rndc.out.1.test$n 2>&1 && ret=1
grep "rndc: '' failed: failure" rndc.out.1.test$n > /dev/null
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......
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