From 9a4f925b5752ab354c21b7f4c4a8161384c114b8 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 1 May 2024 11:54:17 +0200 Subject: [PATCH] TEST-75-RESOLVED: Move knot configuration to /usr/lib/systemd/tests/testdata 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 | 15 --------------- test/meson.build | 1 + test/units/testsuite-75.sh | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/test/TEST-75-RESOLVED/test.sh b/test/TEST-75-RESOLVED/test.sh index 55a9f1b358..6272d5a2f8 100755 --- a/test/TEST-75-RESOLVED/test.sh +++ b/test/TEST-75-RESOLVED/test.sh @@ -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 diff --git a/test/meson.build b/test/meson.build index 4854c3806f..43314f8c79 100644 --- a/test/meson.build +++ b/test/meson.build @@ -4,6 +4,7 @@ if install_tests foreach subdir : [ 'auxv', 'journal-data', + 'knot-data', 'test-journals', 'units', 'test-execute', diff --git a/test/units/testsuite-75.sh b/test/units/testsuite-75.sh index fc29e642fb..fbb46bf261 100755 --- a/test/units/testsuite-75.sh +++ b/test/units/testsuite-75.sh @@ -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 -- 2.25.1