From: Matthijs Mekking Date: Fri, 13 Mar 2026 10:13:35 +0000 (+0100) Subject: Test showzone and modzone on configured zone X-Git-Tag: v9.21.21~36^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=900127c4601382d028af1042db44c36aae54d9fa;p=thirdparty%2Fbind9.git Test showzone and modzone on configured zone Add test cases for 'rndc showzone' and 'rndc modzone' on a zone that was configured in named.conf. This should not crash. --- diff --git a/bin/tests/system/addzone/tests.sh b/bin/tests/system/addzone/tests.sh index a59bc355d93..0cf8be2a753 100755 --- a/bin/tests/system/addzone/tests.sh +++ b/bin/tests/system/addzone/tests.sh @@ -36,6 +36,26 @@ n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) +# showzone +echo_i "showzone normally loaded zone ($n)" +ret=0 +$RNDCCMD 10.53.0.2 showzone normal.example >rndc.out.ns2.$n +expected='zone "normal.example" { type primary; file "normal.db"; };' +[ "$(cat rndc.out.ns2.$n)" = "$expected" ] || ret=1 +n=$((n + 1)) +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status + ret)) +# modzone +echo_i "modzone normally loaded zone ($n)" +ret=0 +$RNDCCMD 10.53.0.2 modzone normal.example '{ type primary; file "normal.db"; };' >rndc.out.ns2.$n +grep "" rndc.out.ns2.$n >/dev/null || ret=1 +grep "zone 'normal.example' must also be reconfigured in" rndc.out.ns2.$n >/dev/null || ret=1 +grep "named.conf to make changes permanent." rndc.out.ns2.$n >/dev/null || ret=1 +n=$((n + 1)) +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status + ret)) + # When LMDB support is compiled in, this tests that migration from # NZF to NZD occurs during named startup echo_i "checking previously added zone ($n)" @@ -263,7 +283,7 @@ status=$((status + ret)) echo_i "delete a normally-loaded zone ($n)" ret=0 $RNDCCMD 10.53.0.2 delzone normal.example >rndc.out.ns2.$n 2>&1 -grep "is no longer active and will be deleted" rndc.out.ns2.$n >/dev/null || ret=11 +grep "is no longer active and will be deleted" rndc.out.ns2.$n >/dev/null || ret=1 grep "To keep it from returning when the server is restarted" rndc.out.ns2.$n >/dev/null || ret=1 grep "must also be removed from named.conf." rndc.out.ns2.$n >/dev/null || ret=1 _check_delete_normally_loaded_zone() ( @@ -271,7 +291,6 @@ _check_delete_normally_loaded_zone() ( && grep 'status: REFUSED' dig.out.ns2.$n >/dev/null ) retry_quiet 5 _check_delete_normally_loaded_zone || ret=1 - n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret))