]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check that 'rndc dnstap -roll <value>' works
authorMark Andrews <marka@isc.org>
Mon, 22 Jun 2020 04:41:55 +0000 (14:41 +1000)
committerMark Andrews <marka@isc.org>
Mon, 29 Jun 2020 22:30:01 +0000 (22:30 +0000)
(cherry picked from commit a289a57c7f21fe2d1b9fb80e34f4d143c89cfc70)

bin/tests/system/conf.sh.common
bin/tests/system/dnstap/clean.sh
bin/tests/system/dnstap/tests.sh

index 37d2933d09291d829855afb3e004e05e3e1626a6..d73a09bff2e83fa5b875aec3f653be5bbb48888f 100644 (file)
@@ -483,6 +483,22 @@ retry_quiet() {
        _retry "$@"
 }
 
+# _repeat: keep running command up to $1 times, unless it fails
+_repeat() (
+    __retries="${1}"
+    shift
+    while :; do
+       if ! "$@"; then
+           return 1
+       fi
+       __retries=$((__retries-1))
+       if [ "${__retries}" -le 0 ]; then
+           break
+       fi
+    done
+    return 0
+)
+
 rndc_reload() {
     echo_i "`$RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} reload $3 2>&1 | sed 's/^/'$1' /'`"
     # reloading single zone is synchronous, if we're reloading whole server
index 20adeeb9e555272980d2226692bbc2a4ad56c446..b194d0fee267f405b3d8b99a693f9e76ab73b1e9 100644 (file)
@@ -21,7 +21,9 @@ rm -f fstrm_capture.out
 rm -f ns*/dnstap.out
 rm -f ns*/dnstap.out.save
 rm -f ns*/dnstap.out.save.?
-rm -f ns*/named.lock
-rm -f ydump.out
 rm -f ns*/managed-keys.bind*
+rm -f ns*/named.lock
+rm -f ns2/dnstap.out.*
 rm -f ns2/example.db ns2/example.db.jnl
+rm -f ns3/dnstap.out.*
+rm -f ydump.out
index 9fe748d3f68a3716670e600bb783c8914dd5a0bd..f6e3bef5b8d3cdeb74f0a602a28cdb923c73b089 100644 (file)
@@ -759,5 +759,28 @@ lines=`$DNSTAPREAD -y large-answer.fstrm | grep -c "opcode: QUERY"`
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+test_dnstap_roll() (
+    ip="$1"
+    ns="$2"
+    n="$3"
+    $RNDCCMD -s "${ip}" dnstap -roll "${n}" | sed "s/^/${ns} /" | cat_i &&
+    files=$(find "$ns" -name "dnstap.out.[0-9]" | wc -l) &&
+    test "$files" -le "${n}" && test "$files" -ge "1"
+)
+
+echo_i "checking 'rndc -roll <value>' (no versions)"
+ret=0
+start_server --noclean --restart --port "${PORT}" dnstap ns3
+_repeat 5 test_dnstap_roll 10.53.0.3 ns3 3 || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
+echo_i "checking 'rndc -roll <value>' (versions)"
+ret=0
+start_server --noclean --restart --port "${PORT}" dnstap ns2
+_repeat 5 test_dnstap_roll 10.53.0.2 ns2 3 || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
 echo_i "exit status: $status"
-[ $status -eq 0 ] || exit 1
+[ "$status" -eq 0 ] || exit 1