]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Improve the way cache contents are searched for "ns.flushtest.example"
authorMichał Kępień <michal@isc.org>
Tue, 20 Feb 2018 12:59:29 +0000 (13:59 +0100)
committerMark Andrews <marka@isc.org>
Tue, 20 Feb 2018 23:38:51 +0000 (10:38 +1100)
During the "check flushtree clears adb correctly" check, expecting
"ns.flushtest.example" to always be the first name in the ADB dump is
fragile, because in a certain corner case "a.root-servers.nil" will be
the first name instead.

As the purpose of the relevant check is to ensure "ns.flushtest.example"
is removed from ADB by "rndc flushtree flushtest.example", search the
entire list of names present in ADB instead of just the first entry when
looking for "ns.flushtest.example".

(cherry picked from commit ca1049b2f36be42a6daa9c04289d51c481cb7b52)

bin/tests/system/cacheclean/tests.sh

index 475dfa79b73842a29f98ade6671200d31b9ad07a..e2304e496d51bac28a7f27281c68ba097e85a67d 100644 (file)
@@ -228,11 +228,11 @@ ret=0
 load_cache
 dump_cache
 mv ns2/named_dump.db.$n ns2/named_dump.db.$n.a
-awk '/plain success\/timeout/ {getline; getline; if ($2 == "ns.flushtest.example") exit(0); exit(1); }' ns2/named_dump.db.$n.a || ret=1
+sed -n '/plain success\/timeout/,/Unassociated entries/p' ns2/named_dump.db.$n.a | grep 'ns.flushtest.example' > /dev/null 2>&1 || ret=1
 $RNDC $RNDCOPTS flushtree flushtest.example || ret=1
 dump_cache
 mv ns2/named_dump.db.$n ns2/named_dump.db.$n.b
-awk '/plain success\/timeout/ {getline; getline; if ($2 == "ns.flushtest.example") exit(1); exit(0); }' ns2/named_dump.db.$n.b || ret=1
+sed -n '/plain success\/timeout/,/Unassociated entries/p' ns2/named_dump.db.$n.b | grep 'ns.flushtest.example' > /dev/null 2>&1 && ret=1
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`