Commit 686ee5bd authored by Mark Andrews's avatar Mark Andrews
Browse files

Check that 'rndc dnstap -roll <value>' works

(cherry picked from commit a289a57c)
parent e2ff063c
Pipeline #45584 failed with stages
in 42 minutes and 1 second
......@@ -516,6 +516,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_dumpdb: call "rndc dumpdb [...]" and wait until it completes
#
# The first argument is the name server instance to send the command to, in the
......
......@@ -479,6 +479,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_dumpdb: call "rndc dumpdb [...]" and wait until it completes
#
# The first argument is the name server instance to send the command to, in the
......
......@@ -22,4 +22,6 @@ rm -f ns*/dnstap.out
rm -f ns*/dnstap.out.save
rm -f ns*/dnstap.out.save.?
rm -f ns*/named.lock
rm -f ns2/dnstap.out.*
rm -f ns3/dnstap.out.*
rm -f ydump.out
......@@ -49,7 +49,7 @@ status=`expr $status + $ret`
# be correct.
$DIG $DIGOPTS @10.53.0.3 a.example > dig.out
wait_for_log 20 "(./NS): query_reset" ns1/named.run || true
wait_for_log 20 "(.): endrequest" ns1/named.run || true
# check three different dnstap reopen/roll methods:
# ns1: dnstap-reopen; ns2: dnstap -reopen; ns3: dnstap -roll
......@@ -611,5 +611,21 @@ 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>'"
ret=0
$PERL $SYSTEMTESTTOP/start.pl --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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment