]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add system test for named-checkconf -e
authorColin Vidal <colin@isc.org>
Tue, 21 Oct 2025 09:53:56 +0000 (11:53 +0200)
committerColin Vidal <colin@isc.org>
Wed, 29 Oct 2025 22:49:25 +0000 (23:49 +0100)
Add a system test checking the command line switch -e of
named-checkconf. The test doesn't care about the whole output of the
effective configuration (in particular to avoid breaking the test for
each default statement that would change) but instead just ensure the
effective configuration is actually returned by checking the presence of
the _bind chaos builtin view as well a user provided view and option
change.

bin/tests/system/checkconf/effective.conf [new file with mode: 0644]
bin/tests/system/checkconf/tests_checkconf.py [new file with mode: 0644]

diff --git a/bin/tests/system/checkconf/effective.conf b/bin/tests/system/checkconf/effective.conf
new file mode 100644 (file)
index 0000000..989997c
--- /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.
+ */
+
+options {
+       listen-on port 5353 { 127.1.2.3; };
+};
+
+view foo {
+};
diff --git a/bin/tests/system/checkconf/tests_checkconf.py b/bin/tests/system/checkconf/tests_checkconf.py
new file mode 100644 (file)
index 0000000..0821334
--- /dev/null
@@ -0,0 +1,26 @@
+# 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 os
+
+import isctest
+
+
+def test_checkconf_effective():
+    proc = isctest.run.cmd([os.environ["CHECKCONF"], "-e", "effective.conf"])
+    checkconf_output = proc.stdout.decode()
+    assert "listen-on port 5353 {\n\t\t127.1.2.3/32;\n\t};" in checkconf_output
+    assert 'view "_bind" chaos {' in checkconf_output
+    assert 'view "foo" {\n}' in checkconf_output
+
+    # builtin-trust-anchors is non documented and internal clause only, it must
+    # not be visible.
+    assert "builtin-trust-anchors" not in checkconf_output