4341. [bug] 'rndc flushtree' could fail to clean the tree if there

wasn't a node at the specified name. [RT #41846]

(cherry picked from commit 6214c3c93a)
This commit is contained in:
Mark Andrews
2016-03-24 11:31:25 +11:00
parent 42b854e5dd
commit 6aec5717c7
6 changed files with 42 additions and 19 deletions

View File

@@ -190,5 +190,32 @@ nrecords=`grep flushtest.example ns2/named_dump.db | grep -v '^;' | wc -l`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:check the check that flushname of a partial match works."
ret=0
in_cache txt second2.top1.flushtest.example || ret=1
$RNDC $RNDCOPTS flushtree example
in_cache txt second2.top1.flushtest.example && ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:check the number of cached records remaining"
ret=0
dump_cache
nrecords=`grep flushtest.example ns2/named_dump.db | grep -v '^;' | egrep '(TXT|ANY)' | wc -l`
[ $nrecords -eq 1 ] || { ret=1; echo "I: found $nrecords records expected 1"; }
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:check flushtree clears adb correctly"
ret=0
load_cache
dump_cache
awk '/plain success\/timeout/ {getline; getline; if ($2 == "ns.flushtest.example") exit(0); exit(1); }' ns2/named_dump.db || ret=1
$RNDC $RNDCOPTS flushtree flushtest.example || ret=1
dump_cache
awk '/plain success\/timeout/ {getline; getline; if ($2 == "ns.flushtest.example") exit(1); exit(0); }' ns2/named_dump.db || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:exit status: $status"
exit $status