2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

Add forward zone checks in the catz system test

Add a new test to check that a catalog zone member zone does not
get processed when there is a pre-existing forward zone with that
same name.
This commit is contained in:
Aram Sargsyan 2022-05-03 22:34:48 +00:00
parent 8156c46bd2
commit b27969ee0b
3 changed files with 116 additions and 1 deletions

View File

@ -80,6 +80,18 @@ view "default" {
file "dom-existing.example.db";
};
zone "dom-existing-forward.example" {
type forward;
forward only;
forwarders { 10.53.0.1; };
};
zone "dom-existing-forward-off.example" {
type forward;
forward only;
forwarders { };
};
zone "catalog1.example" {
type secondary;
file "catalog1.example.db";

View File

@ -40,6 +40,18 @@ view "default" {
file "dom-existing.example.db";
};
zone "dom-existing-forward.example" {
type forward;
forward only;
forwarders { 10.53.0.1; };
};
zone "dom-existing-forward-off.example" {
type forward;
forward only;
forwarders { };
};
zone "catalog1.example" {
type secondary;
file "catalog1.example.db";

View File

@ -713,7 +713,7 @@ n=$((n+1))
echo_i "waiting for secondary to sync up ($n)"
ret=0
wait_for_message ns2/named.run "catz: adding zone 'dom-existing.example' from catalog 'catalog1.example'" &&
wait_for_message ns2/named.run "catz_addmodzone_taskaction: zone 'dom-existing.example' will not be added because it is an explicitly configured zone" || ret=1
wait_for_message ns2/named.run "catz_addmodzone_taskaction: zone 'dom-existing.example' will not be added because it is an explicitly configured zone" || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
@ -725,6 +725,95 @@ grep "192.0.2.1" dig.out.test$n > /dev/null && ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
nextpart ns2/named.run >/dev/null
n=$((n+1))
echo_i "adding a domain dom-existing-forward.example. to primary via RNDC ($n)"
ret=0
echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom-existing-forward.example.db
echo "@ IN NS invalid." >> ns1/dom-existing-forward.example.db
echo "@ IN A 192.0.2.1" >> ns1/dom-existing-forward.example.db
rndccmd 10.53.0.1 addzone dom-existing-forward.example. in default '{type primary; file "dom-existing-forward.example.db"; also-notify { 10.53.0.2; }; notify explicit; };' || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "checking that dom-existing-forward.example. is served by primary ($n)"
ret=0
wait_for_a @10.53.0.1 dom-existing-forward.example. dig.out.test$n || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "adding domain dom-existing-forward.example. to catalog1 zone to test that existing forward zones don't get overwritten ($n)"
ret=0
$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
server 10.53.0.1 ${PORT}
update add dom-existing-forward.zones.catalog1.example. 3600 IN PTR dom-existing-forward.example.
send
END
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "waiting for secondary to sync up ($n)"
ret=0
wait_for_message ns2/named.run "catz: adding zone 'dom-existing-forward.example' from catalog 'catalog1.example'" &&
wait_for_message ns2/named.run "catz_addmodzone_taskaction: zone 'dom-existing-forward.example' will not be processed because of the explicitly configured forwarding for that zone" || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "checking that dom-existing-forward.example. is not served by secondary ($n)"
ret=0
wait_for_no_soa @10.53.0.2 dom-existing-forward.example. dig.out.test$n || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
nextpart ns2/named.run >/dev/null
n=$((n+1))
echo_i "adding a domain dom-existing-forward-off.example. to primary via RNDC ($n)"
ret=0
echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom-existing-forward-off.example.db
echo "@ IN NS invalid." >> ns1/dom-existing-forward-off.example.db
echo "@ IN A 192.0.2.1" >> ns1/dom-existing-forward-off.example.db
rndccmd 10.53.0.1 addzone dom-existing-forward-off.example. in default '{type primary; file "dom-existing-forward-off.example.db"; also-notify { 10.53.0.2; }; notify explicit; };' || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "checking that dom-existing-forward-off.example. is served by primary ($n)"
ret=0
wait_for_a @10.53.0.1 dom-existing-forward-off.example. dig.out.test$n || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "adding domain dom-existing-forward-off.example. to catalog1 zone to test that a zone with turned off forwarding can be used in a catalog zone ($n)"
ret=0
$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
server 10.53.0.1 ${PORT}
update add dom-existing-forward-off.zones.catalog1.example. 3600 IN PTR dom-existing-forward-off.example.
send
END
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "waiting for secondary to sync up ($n)"
ret=0
wait_for_message ns2/named.run "catz: adding zone 'dom-existing-forward-off.example' from catalog 'catalog1.example'" &&
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "checking that dom-existing-forward-off.example. is served by secondary ($n)"
ret=0
wait_for_soa @10.53.0.2 dom-existing-forward-off.example. dig.out.test$n || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "removing all records from catalog1 zone ($n)"
ret=0
@ -743,6 +832,8 @@ $NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
update delete blahblah.636722929740e507aaf27c502812fc395d30fb17.zones.catalog1.example. 3600 IN TXT "blah blah"
update delete version.catalog1.example. 3600 IN A 1.2.3.4
update delete dom-existing.zones.catalog1.example. 3600 IN PTR dom-existing.example.
update delete dom-existing-forward.zones.catalog1.example. 3600 IN PTR dom-existing-forward.example.
update delete dom-existing-forward-off.zones.catalog1.example. 3600 IN PTR dom-existing-forward.example.
send
END
if [ $ret -ne 0 ]; then echo_i "failed"; fi