mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
fix: test: Rewrite views/addzone in loop system test
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. Closes #5617 Merge branch '5617-rewrite-reload-view-test' into 'main' See merge request isc-projects/bind9!11225
This commit is contained in:
commit
1014c622fa
4 changed files with 55 additions and 44 deletions
|
|
@ -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 %}
|
||||
21
bin/tests/system/views/ns2/zone.db.in
Normal file
21
bin/tests/system/views/ns2/zone.db.in
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
25
bin/tests/system/views/tests_views_addzones.py
Normal file
25
bin/tests/system/views/tests_views_addzones.py
Normal file
|
|
@ -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)
|
||||
Loading…
Reference in a new issue