]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use jinja2 templates in serve-stale test
authorNicki Křížek <nicki@isc.org>
Fri, 5 Dec 2025 16:04:33 +0000 (17:04 +0100)
committerNicki Křížek <nicki@isc.org>
Tue, 9 Dec 2025 13:23:17 +0000 (14:23 +0100)
The ns1 named.conf files were sufficiently similar to allow for
de-duplication. No attempt to de-duplicate ns3 was made due to
significant differences among the config files.

19 files changed:
bin/tests/system/serve-stale/ns1/named.conf.j2 [new file with mode: 0644]
bin/tests/system/serve-stale/ns1/named2.conf.j2 [new file with mode: 0644]
bin/tests/system/serve-stale/ns1/named3.conf.j2 [new file with mode: 0644]
bin/tests/system/serve-stale/ns1/named4.conf.j2 [new file with mode: 0644]
bin/tests/system/serve-stale/ns3/named.conf.j2 [moved from bin/tests/system/serve-stale/ns3/named.conf.in with 100% similarity]
bin/tests/system/serve-stale/ns3/named1.conf.j2 [moved from bin/tests/system/serve-stale/ns3/named1.conf.in with 100% similarity]
bin/tests/system/serve-stale/ns3/named2.conf.j2 [moved from bin/tests/system/serve-stale/ns3/named2.conf.in with 100% similarity]
bin/tests/system/serve-stale/ns3/named3.conf.j2 [moved from bin/tests/system/serve-stale/ns3/named3.conf.in with 100% similarity]
bin/tests/system/serve-stale/ns3/named4.conf.j2 [moved from bin/tests/system/serve-stale/ns3/named4.conf.in with 100% similarity]
bin/tests/system/serve-stale/ns3/named5.conf.j2 [moved from bin/tests/system/serve-stale/ns3/named5.conf.in with 100% similarity]
bin/tests/system/serve-stale/ns3/named6.conf.j2 [moved from bin/tests/system/serve-stale/ns3/named6.conf.in with 100% similarity]
bin/tests/system/serve-stale/ns3/named7.conf.j2 [moved from bin/tests/system/serve-stale/ns3/named7.conf.in with 100% similarity]
bin/tests/system/serve-stale/ns3/named8.conf.j2 [moved from bin/tests/system/serve-stale/ns3/named8.conf.in with 100% similarity]
bin/tests/system/serve-stale/ns3/named9.conf.j2 [moved from bin/tests/system/serve-stale/ns3/named9.conf.in with 100% similarity]
bin/tests/system/serve-stale/ns4/named.conf.j2 [moved from bin/tests/system/serve-stale/ns4/named.conf.in with 100% similarity]
bin/tests/system/serve-stale/ns5/named.conf.j2 [moved from bin/tests/system/serve-stale/ns5/named.conf.in with 100% similarity]
bin/tests/system/serve-stale/ns6/named.conf.j2 [moved from bin/tests/system/serve-stale/ns6/named.conf.in with 100% similarity]
bin/tests/system/serve-stale/setup.sh [deleted file]
bin/tests/system/serve-stale/tests.sh

diff --git a/bin/tests/system/serve-stale/ns1/named.conf.j2 b/bin/tests/system/serve-stale/ns1/named.conf.j2
new file mode 100644 (file)
index 0000000..a34c24f
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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 max_stale_ttl = max_stale_ttl | default(3600) %}
+{% set stale_answer_ttl = stale_answer_ttl | default(4) %}
+{% set stale_refresh_time = stale_refresh_time | default(30) %}
+{% set stale_test_zone = stale_test_zone | default(False) %}
+
+key rndc_key {
+       secret "1234abcd8765";
+       algorithm @DEFAULT_HMAC@;
+};
+
+controls {
+       inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
+};
+
+options {
+       query-source address 10.53.0.1;
+       notify-source 10.53.0.1;
+       transfer-source 10.53.0.1;
+       port @PORT@;
+       pid-file "named.pid";
+       listen-on { 10.53.0.1; };
+       listen-on-v6 { none; };
+       allow-transfer { any; };
+       recursion yes;
+       dnssec-validation no;
+       max-stale-ttl @max_stale_ttl@;
+       stale-answer-ttl @stale_answer_ttl@;
+       stale-answer-enable yes;
+       stale-cache-enable yes;
+{% if stale_refresh_time is not none %}
+       stale-refresh-time @stale_refresh_time@;
+{% endif %}
+       servfail-ttl 0;
+};
+
+zone "." {
+       type primary;
+       file "root.db";
+};
+
+{% if stale_test_zone %}
+zone "stale.test" {
+       type primary;
+       file "stale.test.db";
+};
+{% endif %}
diff --git a/bin/tests/system/serve-stale/ns1/named2.conf.j2 b/bin/tests/system/serve-stale/ns1/named2.conf.j2
new file mode 100644 (file)
index 0000000..f936c25
--- /dev/null
@@ -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 stale_refresh_time = 0 %}
+
+{% include "ns1/named.conf.j2" %}
diff --git a/bin/tests/system/serve-stale/ns1/named3.conf.j2 b/bin/tests/system/serve-stale/ns1/named3.conf.j2
new file mode 100644 (file)
index 0000000..28c2f89
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * 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 max_stale_ttl = 20 %}
+{% set stale_answer_ttl = 3 %}
+{% set stale_refresh_time = None %}
+
+{% include "ns1/named.conf.j2" %}
diff --git a/bin/tests/system/serve-stale/ns1/named4.conf.j2 b/bin/tests/system/serve-stale/ns1/named4.conf.j2
new file mode 100644 (file)
index 0000000..6ec4e05
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * 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 max_stale_ttl = 20 %}
+{% set stale_answer_ttl = 3 %}
+{% set stale_refresh_time = 0 %}
+{% set stale_test_zone = True %}
+
+{% include "ns1/named.conf.j2" %}
diff --git a/bin/tests/system/serve-stale/setup.sh b/bin/tests/system/serve-stale/setup.sh
deleted file mode 100644 (file)
index ad6073a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-# 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.
-
-. ../conf.sh
-
-copy_setports ns1/named1.conf.in ns1/named.conf
-copy_setports ns3/named.conf.in ns3/named.conf
-copy_setports ns4/named.conf.in ns4/named.conf
-copy_setports ns5/named.conf.in ns5/named.conf
-copy_setports ns6/named.conf.in ns6/named.conf
index 246038441278e03d6e21bbd9b7f7df4508def168..52949efefe293fe3f3d976cf283be074b6c1678c 100755 (executable)
@@ -291,7 +291,7 @@ status=$((status + ret))
 n=$((n + 1))
 echo_i "updating ns1/named.conf ($n)"
 ret=0
-copy_setports ns1/named2.conf.in ns1/named.conf
+cp ns1/named2.conf ns1/named.conf
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
@@ -537,7 +537,7 @@ echo_i "test server with serve-stale options set, low max-stale-ttl"
 n=$((n + 1))
 echo_i "updating ns1/named.conf ($n)"
 ret=0
-copy_setports ns1/named3.conf.in ns1/named.conf
+cp ns1/named3.conf ns1/named.conf
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
@@ -897,7 +897,7 @@ status=$((status + ret))
 n=$((n + 1))
 echo_i "updating ns1/named.conf ($n)"
 ret=0
-copy_setports ns1/named4.conf.in ns1/named.conf
+cp ns1/named4.conf ns1/named.conf
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
@@ -999,7 +999,7 @@ echo_i "test server with no serve-stale options set"
 n=$((n + 1))
 echo_i "updating ns3/named1.conf ($n)"
 ret=0
-copy_setports ns3/named1.conf.in ns3/named.conf
+cp ns3/named1.conf ns3/named.conf
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
@@ -1724,7 +1724,7 @@ echo_i "test stale-answer-client-timeout (off)"
 n=$((n + 1))
 echo_i "updating ns3/named3.conf ($n)"
 ret=0
-copy_setports ns3/named3.conf.in ns3/named.conf
+cp ns3/named3.conf ns3/named.conf
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
@@ -1851,7 +1851,7 @@ echo_i "test stale-answer-client-timeout (0)"
 n=$((n + 1))
 echo_i "updating ns3/named4.conf ($n)"
 ret=0
-copy_setports ns3/named4.conf.in ns3/named.conf
+cp ns3/named4.conf ns3/named.conf
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
@@ -2172,7 +2172,7 @@ echo_i "test stale-answer-client-timeout (0) and stale-refresh-time (4)"
 n=$((n + 1))
 echo_i "updating ns3/named5.conf ($n)"
 ret=0
-copy_setports ns3/named5.conf.in ns3/named.conf
+cp ns3/named5.conf ns3/named.conf
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
@@ -2357,7 +2357,7 @@ echo_i "test serve-stale's interaction with fetch-limits (cache only)"
 n=$((n + 1))
 echo_i "updating ns3/named6.conf ($n)"
 ret=0
-copy_setports ns3/named6.conf.in ns3/named.conf
+cp ns3/named6.conf ns3/named.conf
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
@@ -2467,7 +2467,7 @@ echo_i "test serve-stale's interaction with fetch limits (dual-mode)"
 n=$((n + 1))
 echo_i "updating ns3/named7.conf ($n)"
 ret=0
-copy_setports ns3/named7.conf.in ns3/named.conf
+cp ns3/named7.conf ns3/named.conf
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
@@ -2549,7 +2549,7 @@ n=$((n + 1))
 echo_i "check DNS64 processing of a stale negative answer ($n)"
 ret=0
 # configure ns3 with dns64
-copy_setports ns3/named8.conf.in ns3/named.conf
+cp ns3/named8.conf ns3/named.conf
 rndc_reload ns3 10.53.0.3
 # flush cache, enable ans2 responses, make sure serve-stale is on
 $RNDCCMD 10.53.0.3 flush >rndc.out.test$n.1 2>&1 || ret=1
@@ -2575,7 +2575,7 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
 # configure ns3 with stale-answer-client-timeout 0 and a delegated zone
-copy_setports ns3/named9.conf.in ns3/named.conf
+cp ns3/named9.conf ns3/named.conf
 rndc_reload ns3 10.53.0.3
 
 n=$((n + 1))