mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-27 20:25:55 -04:00
Use jinja2 templates in catz test
- Use a common ns2/named.conf.j2 template for all the "#TN"
replacements. Instead of commenting out with sed, render the template
differently into ns/namedX.conf using variables.
- Keep the final ns2/named7.conf.j2 (formerly ns2/named2.conf.in) as a
separate template for readability due to significant differences.
(cherry picked from commit 6114444007)
This commit is contained in:
parent
f6e879b550
commit
1d09fc01fc
13 changed files with 139 additions and 34 deletions
|
|
@ -11,6 +11,12 @@
|
|||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
{% set allow_query_blackhole = allow_query_blackhole | default(False) %}
|
||||
{% set bad_dlz = bad_dlz | default(False) %}
|
||||
{% set catalog4 = catalog4 | default(False) %}
|
||||
{% set catalog5 = catalog5 | default(False) %}
|
||||
{% set duplicate_zone = duplicate_zone | default(False) %}
|
||||
|
||||
include "../../_common/rndc.key";
|
||||
|
||||
controls {
|
||||
|
|
@ -29,9 +35,13 @@ options {
|
|||
notify no;
|
||||
notify-delay 0;
|
||||
recursion no;
|
||||
#T5 allow-query { 10.53.0.99; };
|
||||
serial-query-rate 100;
|
||||
dnssec-validation no;
|
||||
|
||||
{% if allow_query_blackhole %}
|
||||
allow-query { 10.53.0.99; };
|
||||
{% endif %}
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -59,12 +69,19 @@ view "default" {
|
|||
default-masters { 10.53.0.1; }
|
||||
min-update-interval 1s
|
||||
zone-directory "nonexistent";
|
||||
#T1 zone "catalog4.example"
|
||||
#T1 min-update-interval 1s
|
||||
#T1 default-masters { 10.53.0.1; };
|
||||
#T2 zone "catalog5.example"
|
||||
#T2 min-update-interval 1s
|
||||
#T2 default-primaries { 10.53.0.1; };
|
||||
|
||||
{% if catalog4 %}
|
||||
zone "catalog4.example"
|
||||
min-update-interval 1s
|
||||
default-masters { 10.53.0.1; };
|
||||
{% endif %}
|
||||
|
||||
{% if catalog5 %}
|
||||
zone "catalog5.example"
|
||||
min-update-interval 1s
|
||||
default-primaries { 10.53.0.1; };
|
||||
{% endif %}
|
||||
|
||||
zone "catalog6.example"
|
||||
min-update-interval 1s
|
||||
default-primaries { 10.53.0.1; };
|
||||
|
|
@ -86,13 +103,15 @@ view "default" {
|
|||
in-memory yes;
|
||||
};
|
||||
|
||||
{% if bad_dlz %}
|
||||
# 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.
|
||||
#T3 dlz "bad-dlz" {
|
||||
#T3 database "dlopen bad-dlz.so example.org";
|
||||
#T3 };
|
||||
dlz "bad-dlz" {
|
||||
database "dlopen bad-dlz.so example.org";
|
||||
};
|
||||
{% endif %}
|
||||
|
||||
zone "dom-existing.example" {
|
||||
type primary;
|
||||
|
|
@ -147,14 +166,16 @@ view "default" {
|
|||
primaries { 10.53.0.1; };
|
||||
};
|
||||
|
||||
{% if duplicate_zone %}
|
||||
# When the following zone configuration is enabled, "dom3.example" should
|
||||
# already exist as a member of "catalog1.example", and named should be able
|
||||
# to deal with that situation (see GL #3911). Make sure that this duplicate
|
||||
# zone comes after the the "catalog1.example" zone in the configuration file.
|
||||
#T4 zone "dom3.example" {
|
||||
#T4 type secondary;
|
||||
#T4 file "dom2.example.db";
|
||||
#T4 };
|
||||
zone "dom3.example" {
|
||||
type secondary;
|
||||
file "dom2.example.db";
|
||||
};
|
||||
{% endif %}
|
||||
|
||||
# No "version" property
|
||||
zone "catalog-bad1.example" {
|
||||
14
bin/tests/system/catz/ns2/named1.conf.j2
Normal file
14
bin/tests/system/catz/ns2/named1.conf.j2
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
{% include "ns2/named.conf.j2" %}
|
||||
16
bin/tests/system/catz/ns2/named2.conf.j2
Normal file
16
bin/tests/system/catz/ns2/named2.conf.j2
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
{% set bad_dlz = True %}
|
||||
|
||||
{% include "ns2/named.conf.j2" %}
|
||||
16
bin/tests/system/catz/ns2/named3.conf.j2
Normal file
16
bin/tests/system/catz/ns2/named3.conf.j2
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
{% set duplicate_zone = True %}
|
||||
|
||||
{% include "ns2/named.conf.j2" %}
|
||||
16
bin/tests/system/catz/ns2/named4.conf.j2
Normal file
16
bin/tests/system/catz/ns2/named4.conf.j2
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
{% set allow_query_blackhole = True %}
|
||||
|
||||
{% include "ns2/named.conf.j2" %}
|
||||
16
bin/tests/system/catz/ns2/named5.conf.j2
Normal file
16
bin/tests/system/catz/ns2/named5.conf.j2
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
{% set catalog4 = True %}
|
||||
|
||||
{% include "ns2/named.conf.j2" %}
|
||||
16
bin/tests/system/catz/ns2/named6.conf.j2
Normal file
16
bin/tests/system/catz/ns2/named6.conf.j2
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
{% set catalog5 = True %}
|
||||
|
||||
{% include "ns2/named.conf.j2" %}
|
||||
|
|
@ -13,11 +13,6 @@
|
|||
|
||||
. ../conf.sh
|
||||
|
||||
copy_setports ns1/named.conf.in ns1/named.conf
|
||||
copy_setports ns2/named1.conf.in ns2/named.conf
|
||||
copy_setports ns3/named.conf.in ns3/named.conf
|
||||
copy_setports ns4/named.conf.in ns4/named.conf
|
||||
|
||||
cp -f ns1/catalog.example.db.in ns1/catalog0.example.db
|
||||
cp -f ns1/catalog.example.db.in ns1/catalog1.example.db
|
||||
cp -f ns3/catalog.example.db.in ns3/catalog2.example.db
|
||||
|
|
|
|||
|
|
@ -659,8 +659,7 @@ nextpart ns2/named.run >/dev/null
|
|||
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
|
||||
cp ns2/named2.conf 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))
|
||||
|
|
@ -675,7 +674,7 @@ 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
|
||||
cp ns2/named1.conf ns2/named.conf
|
||||
rndccmd 10.53.0.2 reconfig || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -686,8 +685,7 @@ nextpart ns2/named.run >/dev/null
|
|||
n=$((n + 1))
|
||||
echo_i "reconfiguring secondary - checking if catz survives another type of failed reconfiguration attempts ($n)"
|
||||
ret=0
|
||||
sed -e "s/^#T4//" <ns2/named1.conf.in >ns2/named.conf.tmp
|
||||
copy_setports ns2/named.conf.tmp ns2/named.conf
|
||||
cp ns2/named3.conf 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))
|
||||
|
|
@ -706,8 +704,7 @@ status=$((status + ret))
|
|||
n=$((n + 1))
|
||||
echo_i "reconfiguring secondary - checking if catz member zones are reconfigured ($n)"
|
||||
ret=0
|
||||
sed -e "s/^#T5//" <ns2/named1.conf.in >ns2/named.conf.tmp
|
||||
copy_setports ns2/named.conf.tmp ns2/named.conf
|
||||
cp ns2/named4.conf ns2/named.conf
|
||||
rndccmd 10.53.0.2 reconfig || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -722,7 +719,7 @@ 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
|
||||
cp ns2/named1.conf ns2/named.conf
|
||||
rndccmd 10.53.0.2 reconfig || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -1725,8 +1722,7 @@ status=$((status + ret))
|
|||
n=$((n + 1))
|
||||
echo_i "reconfiguring secondary - adding catalog4 catalog zone ($n)"
|
||||
ret=0
|
||||
sed -e "s/^#T1//g" <ns2/named1.conf.in >ns2/named.conf.tmp
|
||||
copy_setports ns2/named.conf.tmp ns2/named.conf
|
||||
cp ns2/named5.conf ns2/named.conf
|
||||
rndccmd 10.53.0.2 reconfig || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -1756,8 +1752,7 @@ status=$((status + ret))
|
|||
n=$((n + 1))
|
||||
echo_i "reconfiguring secondary - removing catalog4 catalog zone, adding non-existent catalog5 catalog zone ($n)"
|
||||
ret=0
|
||||
sed -e "s/^#T2//" <ns2/named1.conf.in >ns2/named.conf.tmp
|
||||
copy_setports ns2/named.conf.tmp ns2/named.conf
|
||||
cp ns2/named6.conf 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))
|
||||
|
|
@ -1765,7 +1760,7 @@ status=$((status + ret))
|
|||
n=$((n + 1))
|
||||
echo_i "reconfiguring secondary - removing non-existent catalog5 catalog zone ($n)"
|
||||
ret=0
|
||||
copy_setports ns2/named1.conf.in ns2/named.conf
|
||||
cp ns2/named1.conf ns2/named.conf
|
||||
rndccmd 10.53.0.2 reconfig || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
@ -2556,9 +2551,9 @@ status=$((status + ret))
|
|||
n=$((n + 1))
|
||||
echo_i "checking that reconfig can delete and restore catalog zone configuration ($n)"
|
||||
ret=0
|
||||
copy_setports ns2/named2.conf.in ns2/named.conf
|
||||
cp ns2/named7.conf ns2/named.conf
|
||||
rndccmd 10.53.0.2 reconfig || ret=1
|
||||
copy_setports ns2/named1.conf.in ns2/named.conf
|
||||
cp ns2/named1.conf ns2/named.conf
|
||||
rndccmd 10.53.0.2 reconfig || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
|
|
|||
Loading…
Reference in a new issue