diff --git a/bin/tests/system/views/ns2/named3.conf.in b/bin/tests/system/views/ns2/named.conf.j2 similarity index 80% rename from bin/tests/system/views/ns2/named3.conf.in rename to bin/tests/system/views/ns2/named.conf.j2 index 4c25f30c75..d9d852f82f 100644 --- a/bin/tests/system/views/ns2/named3.conf.in +++ b/bin/tests/system/views/ns2/named.conf.j2 @@ -10,6 +10,7 @@ * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ +{% set zone_names = zone_names | default([]) %} options { query-source address 10.53.0.2; @@ -34,4 +35,11 @@ controls { inet 10.53.0.2 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; }; -include "zones.conf"; +{% for name in zone_names %} +zone "@name@" { + type primary; + file "@name@.db"; + dnssec-policy default; + inline-signing yes; +}; +{% endfor %} diff --git a/bin/tests/system/views/ns2/zone.db.in b/bin/tests/system/views/ns2/zone.db.in new file mode 100644 index 0000000000..c8d05540cb --- /dev/null +++ b/bin/tests/system/views/ns2/zone.db.in @@ -0,0 +1,21 @@ +; Copyright (C) Internet Systems Consortium, Inc. ("ISC") +; +; SPDX-License-Identifier: MPL-2.0 +; +; This Source Code Form is subject to the terms of the Mozilla Public +; License, v. 2.0. If a copy of the MPL was not distributed with this +; file, you can obtain one at https://mozilla.org/MPL/2.0/. +; +; See the COPYRIGHT file distributed with this work for additional +; information regarding copyright ownership. + +$TTL 86400 +@ IN SOA localhost. hostmaster.localhost ( + 1612542642 ; serial + 12H ; refresh + 1H ; retry + 2w ; expiry + 1h ; minimum + ) +@ IN NS localhost +localhost IN A 127.0.0.1 diff --git a/bin/tests/system/views/tests.sh b/bin/tests/system/views/tests.sh index 7b6f28986f..4684f82249 100644 --- a/bin/tests/system/views/tests.sh +++ b/bin/tests/system/views/tests.sh @@ -148,48 +148,5 @@ test "$int" != "$ext" || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) -echo_i "verifying adding of multiple inline zones followed by reconfiguration works" - -[ ! -f ns2/zones.conf ] && touch ns2/zones.conf -copy_setports ns2/named3.conf.in ns2/named.conf - -i=1 -while [ $i -lt 50 ]; do - ret=0 - zone_name=$(printf "example%03d.com" $i) - - # Add a new zone to the configuration. - cat >>ns2/zones.conf <<-EOF - zone "${zone_name}" { - type primary; - file "db.${zone_name}"; - dnssec-policy default; - inline-signing yes; - }; - EOF - - # Create a master file for the zone. - cat >"ns2/db.${zone_name}" <<-EOF - \$TTL 86400 - @ IN SOA localhost. hostmaster.localhost ( - 1612542642 ; serial - 12H ; refresh - 1H ; retry - 2w ; expiry - 1h ; minimum - ) - @ IN NS localhost - localhost IN A 127.0.0.1 - EOF - - $RNDCCMD 10.53.0.2 reconfig || ret=1 - if [ $ret != 0 ]; then - echo_i "failed" - break - fi - i=$((i + 1)) -done -status=$((status + ret)) - echo_i "exit status: $status" [ "$status" -eq 0 ] || exit 1 diff --git a/bin/tests/system/views/tests_views_addzones.py b/bin/tests/system/views/tests_views_addzones.py new file mode 100644 index 0000000000..c362b47721 --- /dev/null +++ b/bin/tests/system/views/tests_views_addzones.py @@ -0,0 +1,25 @@ +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# SPDX-License-Identifier: MPL-2.0 +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +import shutil + + +def test_views_add_zones(ns2, templates): + zone_names = [] + for i in range(50): + name = f"example{i:03}.com" + zone_names.append(name) + templates.render("ns2/named.conf", {"zone_names": zone_names}) + shutil.copyfile("ns2/zone.db.in", f"ns2/{name}.db") + with ns2.watch_log_from_here() as watcher: + ns2.rndc("reconfig", log=False) + log_seq = ["any newly configured zones are now loaded", "running"] + watcher.wait_for_sequence(log_seq)