From 332193940d4b87b97da65de55fac3c6efdd5d697 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 9 May 2017 04:07:48 +1000 Subject: [PATCH] 4617. [test] Update rndc system test to be more delay tolerant. [RT #45177] (cherry picked from commit 31f4fb98e2f43d6fc64d2a1e85633d7c12a07996) --- CHANGES | 3 + bin/tests/system/rndc/clean.sh | 15 ++-- bin/tests/system/rndc/tests.sh | 130 ++++++++++++++++++++++++--------- 3 files changed, 106 insertions(+), 42 deletions(-) diff --git a/CHANGES b/CHANGES index 6daab2375c..d957fc748c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4617. [test] Update rndc system test to be more delay tolerant. + [RT #45177] + 4615. [bug] AD could be set on truncated answer with no records present in the answer and authority sections. [RT #45140] diff --git a/bin/tests/system/rndc/clean.sh b/bin/tests/system/rndc/clean.sh index d9fde77544..f583c6f421 100644 --- a/bin/tests/system/rndc/clean.sh +++ b/bin/tests/system/rndc/clean.sh @@ -14,12 +14,13 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: clean.sh,v 1.2 2011/03/21 18:06:06 each Exp $ - -rm -f ns2/*.db ns2/*.jnl -rm -f ns2/session.key -rm -f ns2/named.stats -rm -f ns3/named_dump.db +rm -f dig.out.*.test* rm -f ns*/named.memstats rm -f ns*/named.run -rm -f rndc.output +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 ns3/named_dump.db +rm -f nsupdate.out.*.test* +rm -f python.out.*.test* +rm -f rndc.out.*.test* diff --git a/bin/tests/system/rndc/tests.sh b/bin/tests/system/rndc/tests.sh index ae1b94995c..58f5b3cca4 100644 --- a/bin/tests/system/rndc/tests.sh +++ b/bin/tests/system/rndc/tests.sh @@ -38,8 +38,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` @@ -49,6 +53,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` @@ -56,7 +65,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` @@ -70,7 +81,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` @@ -80,13 +92,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 < nsupdate.out.1.test$n 2>&1 </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` @@ -97,6 +110,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` @@ -104,21 +122,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 < nsupdate.out.1.test$n 2>&1 </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` @@ -129,6 +150,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` @@ -136,7 +162,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` @@ -150,14 +178,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` @@ -167,15 +198,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` @@ -183,14 +219,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 < nsupdate.out.1.test$n 2>&1 <&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 @@ -198,30 +241,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 < nsupdate.out.2.test$n 2>&1 </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 < nsupdate.out.1.test$n 2>&1 <&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 @@ -229,16 +284,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 < nsupdate.out.2.test$n 2>&1 </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` @@ -300,8 +360,8 @@ 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 9953 -c ../common/rndc.conf flush '"view with a space"' 2>&1 > rndc.output || ret=1 -grep "not found" rndc.output > /dev/null && ret=1 +$RNDC -s 10.53.0.4 -p 9953 -c ../common/rndc.conf 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` @@ -312,8 +372,8 @@ $RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf reconfig > /dev/null || ret=1 sleep 1 mv ns3/named.conf ns3/named.conf.save echo "error error error" >> ns3/named.conf -$RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf reconfig > rndc.output 2>&1 && ret=1 -grep "rndc: 'reconfig' failed: unexpected token" rndc.output > /dev/null || ret=1 +$RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.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 ns3/named.conf.save ns3/named.conf sleep 1 $RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf reconfig > /dev/null || ret=1 @@ -332,8 +392,8 @@ status=`expr $status + $ret` n=`expr $n + 1` echo "I:check 'rndc \"\"' is handled ($n)" ret=0 -$RNDCCMD "" > rndc.out.test$n 2>&1 && ret=1 -grep "rndc: '' failed: failure" rndc.out.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`