A part of the `views` system test attempts to add multiples zones in a
loop, and after each zone being added, reconfig the server.
However, the test didn't take into account the fact that the server
might take a bit more time to reload than the script to move to the next
iteration, and in some case the test was re-requesting the server reload
when it was still reloading.
Since `
b49f83a3`, `named` explicitly fails to reload when a load/reload
is pending, which is (unless proved otherwise) the reason of the test
was now randomly failing.
That part of the test is now waiting for the server log message saying
the server has added the new zone and is running. Also, that part of the
test has been rewrote in Python.
* 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;
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 %}
--- /dev/null
+; 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
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
--- /dev/null
+# 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)