]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-75-RESOLVED: Move knot configuration to /usr/lib/systemd/tests/testdata
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 1 May 2024 09:54:17 +0000 (11:54 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 6 May 2024 08:56:55 +0000 (10:56 +0200)
This allows the logic to install the configuration to be done inside
the test itself which allows it to be shared with mkosi.

test/TEST-75-RESOLVED/test.sh
test/meson.build
test/units/testsuite-75.sh

index 55a9f1b358f1ddf681add0355fe64b7c8d9b25a1..6272d5a2f8919c6a73f7f31a6646554ac75cd88e 100755 (executable)
@@ -11,14 +11,7 @@ NSPAWN_ARGUMENTS="--private-network"
 
 test_require_bin knotd
 
-# We need at least Knot 3.0 which support (among others) the ds-push directive
-if ! knotc -c "${TEST_BASE_DIR:?}/knot-data/knot.conf" conf-check; then
-    echo "This test requires at least Knot 3.0. skipping..."
-    exit 0
-fi
-
 test_append_files() {
-    local workspace="${1:?}"
     # Install knot
     image_install kzonecheck keymgr kjournalprint knotc knotd
     image_install "${ROOTLIBDIR:?}/system/knot.service"
@@ -26,14 +19,6 @@ test_append_files() {
     image_install -o /etc/dbus-1/system.d/cz.nic.knotd.conf
     image_install -o /etc/default/knot
 
-    # Copy over our configuration
-    mkdir -p "${workspace:?}/var/lib/knot/zones/" "${workspace:?}/etc/knot/"
-    cp -rfv "${TEST_BASE_DIR:?}"/knot-data/zones/* "$workspace/var/lib/knot/zones/"
-    cp -fv "${TEST_BASE_DIR:?}/knot-data/knot.conf" "$workspace/etc/knot/knot.conf"
-    chgrp -R knot "$workspace/etc/knot/" "$workspace/var/lib/knot/"
-    chmod -R ug+rwX "$workspace/var/lib/knot/"
-    chmod -R g+r "$workspace/etc/knot/"
-
     # Install DNS-related utilities (usually found in the bind-utils package)
     image_install delv dig host nslookup
 
index 4854c3806f08baddf3302569aef457f8863d7bdf..43314f8c79484904b5bb9562d7d5a78c76e663d6 100644 (file)
@@ -4,6 +4,7 @@ if install_tests
         foreach subdir : [
                 'auxv',
                 'journal-data',
+                'knot-data',
                 'test-journals',
                 'units',
                 'test-execute',
index fc29e642fb0ad2625e68398da1761dd07146e520..fbb46bf2610830909d04858f2f4a05a813d03b2d 100755 (executable)
@@ -14,6 +14,12 @@ set -o pipefail
 # shellcheck source=test/units/util.sh
 . "$(dirname "$0")"/util.sh
 
+# We need at least Knot 3.0 which support (among others) the ds-push directive
+if ! knotc -c /usr/lib/systemd/tests/testdata/knot-data/knot.conf conf-check; then
+    echo "This test requires at least Knot 3.0. skipping..." | tee --append /skipped
+    exit 77
+fi
+
 RUN_OUT="$(mktemp)"
 
 run() {
@@ -246,6 +252,14 @@ ln -svf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
 mkdir -p "/etc/dnssec-trust-anchors.d/"
 echo local >/etc/dnssec-trust-anchors.d/local.negative
 
+# Copy over our knot configuration
+mkdir -p /var/lib/knot/zones/ /etc/knot/
+cp -rfv /usr/lib/systemd/tests/testdata/knot-data/zones/* /var/lib/knot/zones/
+cp -fv /usr/lib/systemd/tests/testdata/knot-data/knot.conf /etc/knot/knot.conf
+chgrp -R knot /etc/knot/ /var/lib/knot/
+chmod -R ug+rwX /var/lib/knot/
+chmod -R g+r /etc/knot/
+
 # Sign the root zone
 keymgr . generate algorithm=ECDSAP256SHA256 ksk=yes zsk=yes
 # Create a trust anchor for resolved with our root zone
@@ -268,6 +282,7 @@ systemctl start systemd-networkd
 /usr/lib/systemd/systemd-networkd-wait-online --interface=dns1:routable --timeout=60
 systemctl reload systemd-resolved
 systemctl start resolved-dummy-server
+
 # Create knot's runtime dir, since from certain version it's provided only by
 # the package and not created by tmpfiles/systemd
 if [[ ! -d /run/knot ]]; then