From ebc92b799bb97698a367e13a42ce1b91ccce0f20 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 3 Aug 2021 16:04:41 +1000 Subject: [PATCH] Check 'rndc freeze' with in-view zones works --- bin/tests/system/rndc/clean.sh | 1 + bin/tests/system/rndc/ns4/named.conf.in | 11 +++++- bin/tests/system/rndc/setup.sh | 2 ++ bin/tests/system/rndc/tests.sh | 48 +++++++++++++++++++++++-- 4 files changed, 59 insertions(+), 3 deletions(-) diff --git a/bin/tests/system/rndc/clean.sh b/bin/tests/system/rndc/clean.sh index 25ec6c8f68..9faf948262 100644 --- a/bin/tests/system/rndc/clean.sh +++ b/bin/tests/system/rndc/clean.sh @@ -18,6 +18,7 @@ rm -f ns2/nil.db ns2/other.db ns2/static.db ns2/*.jnl rm -f ns2/session.key rm -f ns3/named_dump.db* rm -f ns4/*.nta +rm -f ns4/example.db ns4/example.db.jnl rm -f ns4/key?.conf rm -f ns6/huge.zone.db rm -f ns*/named.conf diff --git a/bin/tests/system/rndc/ns4/named.conf.in b/bin/tests/system/rndc/ns4/named.conf.in index 4f009a7c2d..674e63904b 100644 --- a/bin/tests/system/rndc/ns4/named.conf.in +++ b/bin/tests/system/rndc/ns4/named.conf.in @@ -15,13 +15,22 @@ options { listen-on { 10.53.0.4; }; listen-on-v6 { none; }; recursion yes; - dnssec-validation yes; + dnssec-validation yes; }; view normal { match-clients { any; }; + + zone example { + type primary; + file "example.db"; + allow-update { any; }; + }; }; view "view with a space" { match-clients { none; }; + zone example { + in-view normal; + }; }; diff --git a/bin/tests/system/rndc/setup.sh b/bin/tests/system/rndc/setup.sh index e4bd9ae134..fb56de80a4 100644 --- a/bin/tests/system/rndc/setup.sh +++ b/bin/tests/system/rndc/setup.sh @@ -15,6 +15,8 @@ $SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 >ns2/nil.db $SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 >ns2/other.db $SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 >ns2/static.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 >ns4/example.db + $SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 >ns6/huge.zone.db # we make the huge zone less huge if we're running under diff --git a/bin/tests/system/rndc/tests.sh b/bin/tests/system/rndc/tests.sh index f847b2ad0b..c3dda378f8 100644 --- a/bin/tests/system/rndc/tests.sh +++ b/bin/tests/system/rndc/tests.sh @@ -40,7 +40,7 @@ if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) echo_i "rndc freeze" -$RNDCCMD 10.53.0.2 freeze | sed 's/^/ns2 /' | cat_i | cat_i +$RNDCCMD 10.53.0.2 freeze | sed 's/^/ns2 /' | cat_i n=$((n+1)) echo_i "checking zone was dumped ($n)" @@ -426,7 +426,7 @@ n=$((n+1)) echo_i "testing automatic zones are reported ($n)" ret=0 $RNDC -s 10.53.0.4 -p ${EXTRAPORT6} -c ns4/key6.conf status > rndc.out.1.test$n || ret=1 -grep "number of zones: 200 (198 automatic)" rndc.out.1.test$n > /dev/null || ret=1 +grep "number of zones: 201 (198 automatic)" rndc.out.1.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -689,5 +689,49 @@ lines=`cat rndc.out.test$n | wc -l` if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) +n=$((n+1)) +echo_i "check 'rndc freeze' with in-view zones works ($n)" +ret=0 +$RNDC -s 10.53.0.4 -p ${EXTRAPORT6} -c ns4/key6.conf freeze > rndc.out.test$n 2>&1 || ret=1 +test -s rndc.out.test$n && sed 's/^/ns2 /' rndc.out.test$n | cat_i +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) + +n=$((n+1)) +echo_i "checking non in-view zone instance is not writable ($n)" +ret=0 +$NSUPDATE -p ${PORT} > /dev/null 2>&1 < dig.out.1.test$n +grep 'addition 3' dig.out.1.test$n >/dev/null && ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) + +n=$((n+1)) +echo_i "check 'rndc thaw' with in-view zones works ($n)" +ret=0 +$RNDC -s 10.53.0.4 -p ${EXTRAPORT6} -c ns4/key6.conf thaw > rndc.out.test$n 2>&1 || ret=1 +test -s rndc.out.test$n && sed 's/^/ns2 /' rndc.out.test$n | cat_i +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) + +n=$((n+1)) +echo_i "checking non in-view zone instance is now writable ($n)" +ret=0 +$NSUPDATE -p ${PORT} > nsupdate.out.test$n 2>&1 < dig.out.1.test$n +grep 'addition 3' dig.out.1.test$n >/dev/null || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1