]> 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>
Wed, 21 Feb 2018 00:28:21 +0000 (11:28 +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)
(cherry picked from commit 3513a585e338425270cf2d7c63aa7a0b17444671)

bin/tests/system/cacheclean/tests.sh

index b2552cdeb933c9541abbf5bda70896dd9b321f72..de46caf0b261588d2bf757de98d20ca790495178 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`