diff --git a/bin/tests/system/conf.sh.common b/bin/tests/system/conf.sh.common index 02dd4fa41a..b2fafd453c 100644 --- a/bin/tests/system/conf.sh.common +++ b/bin/tests/system/conf.sh.common @@ -547,6 +547,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 diff --git a/bin/tests/system/dnstap/clean.sh b/bin/tests/system/dnstap/clean.sh index 20adeeb9e5..b194d0fee2 100644 --- a/bin/tests/system/dnstap/clean.sh +++ b/bin/tests/system/dnstap/clean.sh @@ -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 diff --git a/bin/tests/system/dnstap/tests.sh b/bin/tests/system/dnstap/tests.sh index d8901db657..7321cc0b6d 100644 --- a/bin/tests/system/dnstap/tests.sh +++ b/bin/tests/system/dnstap/tests.sh @@ -758,5 +758,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 . -name "${ns}/dnstap.out.*" | wc -l) && + test "$files" -le "${n}" +) + +echo_i "checking 'rndc -roll ' (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 ' (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