]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add a system test for view reverting after a failed reconfiguration
authorAram Sargsyan <aram@isc.org>
Wed, 29 Dec 2021 09:07:03 +0000 (09:07 +0000)
committerAram Sargsyan <aram@isc.org>
Tue, 25 Jan 2022 08:21:50 +0000 (08:21 +0000)
Test the view reverting code by introducing a faulty dlz configuration
in named.conf and using `rndc reconfig` to check if named handles the
situation correctly.

We use "dlz" because the dlz processing code is located in an ideal
place in the view configuration function for the test to cover the
view reverting code.

This test is specifically added to the catz system test to additionally
cover the catz reconfiguration during the mentioned failed
reconfiguration attempt.

bin/tests/system/catz/ns2/named1.conf.in
bin/tests/system/catz/tests.sh

index a56474600d48857cac3521ae079accd933fe4696..041264832cd9c2851e5bd7a206e27dcd69e53a14 100644 (file)
@@ -46,6 +46,14 @@ options {
        };
 };
 
+# A faulty dlz configuration to check if named and catz survive a certain class
+# of failed configuration attempts (see GL#3060).
+# We use "dlz" because the dlz processing code is located in an ideal place in
+# the view configuration function for the test to cover the view reverting code.
+#T3dlz "bad-dlz" {
+#T3    database "dlopen bad-dlz.so example.org";
+#T3};
+
 zone "catalog1.example" {
        type secondary;
        file "catalog1.example.db";
index 30dd80c1729f828cbbc14ab3de059ad9d05bd075..9dd2ec33b1cb1149dbbe8f63d746317174d24f47 100644 (file)
@@ -369,6 +369,30 @@ wait_for_soa @10.53.0.2 dom3.example. dig.out.test$n || ret=1
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
+n=$((n+1))
+echo_i "reconfiguring secondary - checking if catz survives a certain class of failed reconfiguration attempts ($n)"
+ret=0
+sed -e "s/^#T3//" < ns2/named1.conf.in > ns2/named.conf.tmp
+copy_setports ns2/named.conf.tmp ns2/named.conf
+$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p "${CONTROLPORT}" reconfig > /dev/null 2>&1 && ret=1
+if [ $ret -ne 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
+n=$((n+1))
+echo_i "checking again that dom3.example. is served by secondary ($n)"
+ret=0
+wait_for_soa @10.53.0.2 dom3.example. dig.out.test$n || ret=1
+if [ $ret -ne 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
+n=$((n+1))
+echo_i "reconfiguring secondary - reverting the bad configuration ($n)"
+ret=0
+copy_setports ns2/named1.conf.in ns2/named.conf
+rndccmd 10.53.0.2 reconfig || 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