]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use jinja2 templates in forward test
authorNicki Křížek <nicki@isc.org>
Fri, 5 Dec 2025 16:03:51 +0000 (17:03 +0100)
committerNicki Křížek <nicki@isc.org>
Tue, 9 Dec 2025 13:23:14 +0000 (14:23 +0100)
- Merge options-tls.conf into named.conf in ns2 and ns4 and render it
  conditionally. Also conditionally include the additional
  named-tls.conf which is always rendered.
- Use multiple templates for ns3 and ns9 and replace the copy_setports.
- In ns3/named2.conf, use "root2.db" directly rather than replacing it
  with "sed" later.

20 files changed:
bin/tests/system/forward/ns1/named.conf.j2 [moved from bin/tests/system/forward/ns1/named.conf.in with 100% similarity]
bin/tests/system/forward/ns10/named.conf.j2 [moved from bin/tests/system/forward/ns10/named.conf.in with 100% similarity]
bin/tests/system/forward/ns2/named-tls.conf.j2 [moved from bin/tests/system/forward/ns2/named-tls.conf.in with 100% similarity]
bin/tests/system/forward/ns2/named.conf.j2 [moved from bin/tests/system/forward/ns2/named.conf.in with 80% similarity]
bin/tests/system/forward/ns2/options-tls.conf.in [deleted file]
bin/tests/system/forward/ns3/named.conf.j2 [moved from bin/tests/system/forward/ns3/named1.conf.in with 100% similarity]
bin/tests/system/forward/ns3/named2.conf.j2 [moved from bin/tests/system/forward/ns3/named2.conf.in with 98% similarity]
bin/tests/system/forward/ns4/named-tls.conf.j2 [moved from bin/tests/system/forward/ns4/named-tls.conf.in with 100% similarity]
bin/tests/system/forward/ns4/named.conf.j2 [moved from bin/tests/system/forward/ns4/named.conf.in with 91% similarity]
bin/tests/system/forward/ns4/options-tls.conf.in [deleted file]
bin/tests/system/forward/ns5/named.conf.j2 [moved from bin/tests/system/forward/ns5/named.conf.in with 100% similarity]
bin/tests/system/forward/ns7/named.conf.j2 [moved from bin/tests/system/forward/ns7/named.conf.in with 100% similarity]
bin/tests/system/forward/ns8/named.conf.j2 [moved from bin/tests/system/forward/ns8/named.conf.in with 100% similarity]
bin/tests/system/forward/ns9/named.conf.j2 [moved from bin/tests/system/forward/ns9/named1.conf.in with 100% similarity]
bin/tests/system/forward/ns9/named2.conf.j2 [moved from bin/tests/system/forward/ns9/named2.conf.in with 100% similarity]
bin/tests/system/forward/ns9/named3.conf.j2 [moved from bin/tests/system/forward/ns9/named3.conf.in with 100% similarity]
bin/tests/system/forward/ns9/named4.conf.j2 [moved from bin/tests/system/forward/ns9/named4.conf.in with 100% similarity]
bin/tests/system/forward/setup.sh
bin/tests/system/forward/tests.sh
bin/tests/system/forward/tests_sh_forward.py

similarity index 80%
rename from bin/tests/system/forward/ns2/named.conf.in
rename to bin/tests/system/forward/ns2/named.conf.j2
index 02da868fb2c643e1081301647f234437cd3f0867..b42a34f1590040109c0beb5df49ca2e715310f1e 100644 (file)
@@ -11,7 +11,9 @@
  * information regarding copyright ownership.
  */
 
+{% if FEATURE_FIPS_DH == "1" %}
 include "named-tls.conf";
+{% endif %}
 
 options {
        query-source address 10.53.0.2;
@@ -23,10 +25,18 @@ options {
        port @PORT@;
        pid-file "named.pid";
        listen-on { 10.53.0.2; };
-       include "options-tls.conf";
        listen-on-v6 { fd92:7065:b8e:ffff::2; };
        recursion no;
        dnssec-validation no;
+
+{% if FEATURE_FIPS_DH == "1" %}
+       tls-port @TLSPORT@;
+       listen-on tls ephemeral { 10.53.0.2; };
+       listen-on port @EXTRAPORT1@ tls tls-forward-secrecy { 10.53.0.2; };
+       listen-on port @EXTRAPORT2@ tls tls-forward-secrecy-mutual-tls { 10.53.0.2; };
+       listen-on port @EXTRAPORT3@ tls tls-expired { 10.53.0.2; };
+{% endif %}
+
 };
 
 zone "." {
diff --git a/bin/tests/system/forward/ns2/options-tls.conf.in b/bin/tests/system/forward/ns2/options-tls.conf.in
deleted file mode 100644 (file)
index fab1fa7..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * 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.
- */
-
-        tls-port @TLSPORT@;
-        listen-on tls ephemeral { 10.53.0.2; };
-        listen-on port @EXTRAPORT1@ tls tls-forward-secrecy { 10.53.0.2; };
-        listen-on port @EXTRAPORT2@ tls tls-forward-secrecy-mutual-tls { 10.53.0.2; };
-        listen-on port @EXTRAPORT3@ tls tls-expired { 10.53.0.2; };
similarity index 98%
rename from bin/tests/system/forward/ns3/named2.conf.in
rename to bin/tests/system/forward/ns3/named2.conf.j2
index 986a60e02d2e7a1b98b00fb3b7102f98e6383b69..4d032689cac375dcb580070d15ce22cb627bf5ad 100644 (file)
@@ -39,5 +39,5 @@ controls {
 
 zone "." {
        type hint;
-       file "root.db";
+       file "root2.db";
 };
similarity index 91%
rename from bin/tests/system/forward/ns4/named.conf.in
rename to bin/tests/system/forward/ns4/named.conf.j2
index cd7c5000d9a6e8f9b33f5304e24514b9ab21cd24..5a12eef685c653b659a391fdfe4480e5f50990e8 100644 (file)
  * information regarding copyright ownership.
  */
 
+{% if FEATURE_FIPS_DH == "1" %}
 include "named-tls.conf";
+{% endif %}
 
 options {
        query-source address 10.53.0.4;
        notify-source 10.53.0.4;
        transfer-source 10.53.0.4;
        port @PORT@;
-       include "options-tls.conf";
        pid-file "named.pid";
        listen-on { 10.53.0.4; };
        listen-on-v6 { none; };
        recursion yes;
        dnssec-validation no;
        minimal-responses yes;
-};
 
+{% if FEATURE_FIPS_DH == "1" %}
+       tls-port @TLSPORT@;
+{% endif %}
+
+};
 
 statistics-channels { inet 10.53.0.4 port @EXTRAPORT1@ allow { localhost; }; };
 
diff --git a/bin/tests/system/forward/ns4/options-tls.conf.in b/bin/tests/system/forward/ns4/options-tls.conf.in
deleted file mode 100644 (file)
index fe3491e..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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.
- */
-
-       tls-port @TLSPORT@;
index 4251008b4004ead9c946da8574f5184a3ffe739d..73e9c004858337ffd21b395fc5a36f9d71c4d132 100644 (file)
 
 . ../conf.sh
 
-copy_setports ns1/named.conf.in ns1/named.conf
-
-if $FEATURETEST --have-fips-dh; then
-  copy_setports ns2/named-tls.conf.in ns2/named-tls.conf
-  copy_setports ns2/options-tls.conf.in ns2/options-tls.conf
-  copy_setports ns2/named.conf.in ns2/named.conf
-else
-  cp /dev/null ns2/named-tls.conf
-  cp /dev/null ns2/options-tls.conf
-  copy_setports ns2/named.conf.in ns2/named.conf
-fi
-
-copy_setports ns3/named1.conf.in ns3/named.conf
-
-if $FEATURETEST --have-fips-dh; then
-  copy_setports ns4/named-tls.conf.in ns4/named-tls.conf
-  copy_setports ns4/options-tls.conf.in ns4/options-tls.conf
-  copy_setports ns4/named.conf.in ns4/named.conf
-else
-  cp /dev/null ns4/named-tls.conf
-  cp /dev/null ns4/options-tls.conf
-  copy_setports ns4/named.conf.in ns4/named.conf
-fi
-
-copy_setports ns5/named.conf.in ns5/named.conf
-copy_setports ns7/named.conf.in ns7/named.conf
-copy_setports ns8/named.conf.in ns8/named.conf
-copy_setports ns9/named1.conf.in ns9/named.conf
-copy_setports ns10/named.conf.in ns10/named.conf
-
 (
   cd ns1
   $SHELL sign.sh
index 0e4fd5ac62b8b74c533b98fbe26a1d5789e2d37d..024e21c3c7cbf2ee5fc96791eddc7277b1107e4b 100644 (file)
@@ -317,7 +317,7 @@ status=$((status + ret))
 n=$((n + 1))
 echo_i "checking switch from forwarding to normal resolution while chasing DS ($n)"
 ret=0
-copy_setports ns3/named2.conf.in ns3/named.conf
+cp ns3/named2.conf ns3/named.conf
 rndccmd 10.53.0.3 reconfig 2>&1 | sed 's/^/ns3 /' | cat_i
 sleep 1
 nextpart ns3/named.run >/dev/null
@@ -332,9 +332,7 @@ sendcmd 10.53.0.11 send-responses "disable"
 n=$((n + 1))
 echo_i "checking the handling of hung DS fetch while chasing DS ($n)"
 ret=0
-copy_setports ns3/named2.conf.in ns3/tmp
-sed 's/root.db/root2.db/' ns3/tmp >ns3/named.conf
-rm -f ns3/tmp
+cp ns3/named2.conf ns3/named.conf
 rndccmd 10.53.0.3 reconfig 2>&1 | sed 's/^/ns3 /' | cat_i
 rndccmd 10.53.0.3 flush 2>&1 | sed 's/^/ns3 /' | cat_i
 sleep 1
@@ -401,7 +399,7 @@ run_spooftests() {
 echo_i "checking spoofed response scenarios with forward first zones"
 run_spooftests
 
-copy_setports ns9/named2.conf.in ns9/named.conf
+cp ns9/named2.conf ns9/named.conf
 rndccmd 10.53.0.9 reconfig 2>&1 | sed 's/^/ns3 /' | cat_i
 rndccmd 10.53.0.9 flush 2>&1 | sed 's/^/ns3 /' | cat_i
 sleep 1
@@ -414,7 +412,7 @@ run_spooftests
 # similar to the ones above, but not identical.
 #
 echo_i "rechecking spoofed response scenarios with 'forward only' set globally"
-copy_setports ns9/named3.conf.in ns9/named.conf
+cp ns9/named3.conf ns9/named.conf
 rndccmd 10.53.0.9 reconfig 2>&1 | sed 's/^/ns3 /' | cat_i
 rndccmd 10.53.0.9 flush 2>&1 | sed 's/^/ns3 /' | cat_i
 sleep 1
@@ -451,7 +449,7 @@ status=$((status + ret))
 # the namespace is defined by the zone content.
 #
 echo_i "rechecking spoofed response scenarios glue below local zone"
-copy_setports ns9/named4.conf.in ns9/named.conf
+cp ns9/named4.conf ns9/named.conf
 rndccmd 10.53.0.9 reconfig 2>&1 | sed 's/^/ns3 /' | cat_i
 rndccmd 10.53.0.9 flush 2>&1 | sed 's/^/ns3 /' | cat_i
 sleep 1
index 4ffec3fbd7de5176d9b87128e8ae6753287ff506..458928b0bc81e0106ef63ccefe3103053bb630ce 100644 (file)
@@ -25,10 +25,8 @@ pytestmark = pytest.mark.extra_artifacts(
         "ns1/root.db",
         "ns1/root.db.signed",
         "ns2/named-tls.conf",
-        "ns2/options-tls.conf",
         "ns3/trusted.conf",
         "ns4/named-tls.conf",
-        "ns4/options-tls.conf",
         "ns9/named_dump.db",
     ]
 )