]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use jinja2 templates in statistics test
authorNicki Křížek <nicki@isc.org>
Fri, 5 Dec 2025 16:19:59 +0000 (17:19 +0100)
committerNicki Křížek <nicki@isc.org>
Tue, 9 Dec 2025 13:23:17 +0000 (14:23 +0100)
- Merge ns*/statistics-channels.conf.in config snippets into
  conditionally rendered section in ns*/named.conf.j2 files.
- Turn ns2/named.conf.in into ns2/named1.conf.j2 because it is used
  later in the test to restore the original config.
- Symlink the ns2/named.conf.j2 ns2/named1.conf.j2 to pick a starting
  config.

bin/tests/system/statistics/ns1/named.conf.j2 [moved from bin/tests/system/statistics/ns1/named.conf.in with 85% similarity]
bin/tests/system/statistics/ns1/statistics-channels.conf.in [deleted file]
bin/tests/system/statistics/ns2/named.conf.j2 [new symlink]
bin/tests/system/statistics/ns2/named1.conf.j2 [moved from bin/tests/system/statistics/ns2/named.conf.in with 87% similarity]
bin/tests/system/statistics/ns2/named2.conf.j2 [moved from bin/tests/system/statistics/ns2/named2.conf.in with 87% similarity]
bin/tests/system/statistics/ns2/statistics-channels.conf.in [deleted file]
bin/tests/system/statistics/ns3/named.conf.j2 [moved from bin/tests/system/statistics/ns3/named.conf.in with 88% similarity]
bin/tests/system/statistics/ns3/statistics-channels.conf.in [deleted file]
bin/tests/system/statistics/setup.sh [deleted file]
bin/tests/system/statistics/tests.sh

similarity index 85%
rename from bin/tests/system/statistics/ns1/named.conf.in
rename to bin/tests/system/statistics/ns1/named.conf.j2
index 2048d73bf94a2c2784a913e777241e780512c67c..efd54f2651b51ec80f23f08cb76c1cffbe809c6a 100644 (file)
@@ -24,7 +24,11 @@ options {
        notify yes;
 };
 
-include "statistics-channels.conf";
+{% if FEATURE_LIBXML2 == "1" or FEATURE_JSON_C == "1" %}
+statistics-channels {
+       inet 10.53.0.1 port @EXTRAPORT1@ allow { any; };
+};
+{% endif %}
 
 zone "." {
        type primary;
diff --git a/bin/tests/system/statistics/ns1/statistics-channels.conf.in b/bin/tests/system/statistics/ns1/statistics-channels.conf.in
deleted file mode 100644 (file)
index 12a1e27..0000000
+++ /dev/null
@@ -1,16 +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.
- */
-
-statistics-channels {
-        inet 10.53.0.1 port @EXTRAPORT1@ allow { any; };
-};
diff --git a/bin/tests/system/statistics/ns2/named.conf.j2 b/bin/tests/system/statistics/ns2/named.conf.j2
new file mode 120000 (symlink)
index 0000000..96e5f1d
--- /dev/null
@@ -0,0 +1 @@
+named1.conf.j2
\ No newline at end of file
similarity index 87%
rename from bin/tests/system/statistics/ns2/named.conf.in
rename to bin/tests/system/statistics/ns2/named1.conf.j2
index fa34de55d8aaf6203d0513890db3f2eeda14e636..832e5cf73c9e2a37ab563548c00b2239d2a12888 100644 (file)
@@ -24,8 +24,11 @@ options {
        notify yes;
 };
 
-
-include "statistics-channels.conf";
+{% if FEATURE_LIBXML2 == "1" or FEATURE_JSON_C == "1" %}
+statistics-channels {
+       inet 10.53.0.2 port @EXTRAPORT1@ allow { any; };
+};
+{% endif %}
 
 key rndc_key {
        secret "1234abcd8765";
similarity index 87%
rename from bin/tests/system/statistics/ns2/named2.conf.in
rename to bin/tests/system/statistics/ns2/named2.conf.j2
index 4b8e5030f14fae5afd0098cac5f8063d02c91f21..7b41fb06c03b8d7d80a19025774fa72badeda004 100644 (file)
@@ -24,7 +24,11 @@ options {
        notify yes;
 };
 
-include "statistics-channels.conf";
+{% if FEATURE_LIBXML2 == "1" or FEATURE_JSON_C == "1" %}
+statistics-channels {
+       inet 10.53.0.2 port @EXTRAPORT1@ allow { any; };
+};
+{% endif %}
 
 key rndc_key {
        secret "1234abcd8765";
diff --git a/bin/tests/system/statistics/ns2/statistics-channels.conf.in b/bin/tests/system/statistics/ns2/statistics-channels.conf.in
deleted file mode 100644 (file)
index 6dd1516..0000000
+++ /dev/null
@@ -1,16 +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.
- */
-
-statistics-channels {
-        inet 10.53.0.2 port @EXTRAPORT1@ allow { any; };
-};
similarity index 88%
rename from bin/tests/system/statistics/ns3/named.conf.in
rename to bin/tests/system/statistics/ns3/named.conf.j2
index 2caaf8cfbeca14f2a19ba60a294488acb25a49e2..74e185fc62a7ec039c2f7512a817feac8bdeeb45 100644 (file)
@@ -27,8 +27,11 @@ options {
        zone-statistics yes;
 };
 
-
-include "statistics-channels.conf";
+{% if FEATURE_LIBXML2 == "1" or FEATURE_JSON_C == "1" %}
+statistics-channels {
+       inet 10.53.0.3 port @EXTRAPORT1@ allow { any; };
+};
+{% endif %}
 
 key rndc_key {
        secret "1234abcd8765";
diff --git a/bin/tests/system/statistics/ns3/statistics-channels.conf.in b/bin/tests/system/statistics/ns3/statistics-channels.conf.in
deleted file mode 100644 (file)
index a755c39..0000000
+++ /dev/null
@@ -1,16 +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.
- */
-
-statistics-channels {
-        inet 10.53.0.3 port @EXTRAPORT1@ allow { any; };
-};
diff --git a/bin/tests/system/statistics/setup.sh b/bin/tests/system/statistics/setup.sh
deleted file mode 100644 (file)
index 37f52f5..0000000
+++ /dev/null
@@ -1,25 +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
-
-for d in ns1 ns2 ns3; do
-  conf=named.conf
-  copy_setports "${d}/${conf}.in" "${d}/${conf}"
-  conf=statistics-channels.conf
-  if $FEATURETEST --have-libxml2 || $FEATURETEST --have-json-c; then
-    copy_setports "${d}/${conf}.in" "${d}/${conf}"
-  else
-    echo "" >"${d}/${conf}"
-  fi
-done
index a69bd36a2a7f3a6db1698e401fa05f4ad4dcf123..dab0f28a4900ce7e9700eb28a1563a0417a5fd6a 100644 (file)
@@ -354,17 +354,17 @@ ret=0
 rndc_stats ns2 10.53.0.2 || ret=1
 sed -n '/Per Zone Query Statistics/,/^++/p' $last_stats | grep -F '[example]' >/dev/null && ret=0
 # turn on
-copy_setports ns2/named2.conf.in ns2/named.conf
+cp ns2/named2.conf ns2/named.conf
 rndc_reconfig ns2 10.53.0.2
 rndc_stats ns2 10.53.0.2 || ret=1
 sed -n '/Per Zone Query Statistics/,/^++/p' $last_stats | grep -F '[example]' >/dev/null || ret=1
 # turn off
-copy_setports ns2/named.conf.in ns2/named.conf
+cp ns2/named1.conf ns2/named.conf
 rndc_reconfig ns2 10.53.0.2
 rndc_stats ns2 10.53.0.2 || ret=1
 sed -n '/Per Zone Query Statistics/,/^++/p' $last_stats | grep -F '[example]' >/dev/null && ret=0
 # turn on
-copy_setports ns2/named2.conf.in ns2/named.conf
+cp ns2/named2.conf ns2/named.conf
 rndc_reconfig ns2 10.53.0.2
 rndc_stats ns2 10.53.0.2 || ret=1
 sed -n '/Per Zone Query Statistics/,/^++/p' $last_stats | grep -F '[example]' >/dev/null || ret=1