Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test fixes for v255 #361

Merged
merged 6 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
5 changes: 5 additions & 0 deletions test/TEST-08-INITRD/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ EOF
}

check_result_qemu_hook() {
local workspace="${1:?}"
local console_log="${TESTDIR:?}/console.log"

if [[ -e "$workspace/skipped" ]]; then
return 0
fi

if [[ ! -e "$console_log" ]]; then
dfatal "Missing console log - this shouldn't happen"
return 1
Expand Down
1 change: 0 additions & 1 deletion test/knot-data/knot.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ policy:
ksk-lifetime: 365d
ksk-submission: parent_zone_sbm
nsec3: on
nsec3-iterations: 10
propagation-delay: 1s
signing-threads: 4
zone-max-ttl: 1s
Expand Down
49 changes: 28 additions & 21 deletions test/test-functions
Original file line number Diff line number Diff line change
Expand Up @@ -1327,19 +1327,35 @@ install_compiled_systemd() {
fi
}

install_package_file() {
local file="${1:?}"

# Skip missing files (like /etc/machine-info)
[[ ! -e "$file" ]] && return 0
# Skip python unit tests, since the image_install machinery will try to pull
# in the whole python stack in a very questionable state, making the tests fail.
# And given we're trying to transition to mkosi-based images anyway I'm not even
# going to bother
[[ "$file" =~ /tests/unit-tests/.*.py$ ]] && return 0
# If the current file is a directory, create it with the original
# mode; if it's a symlink to a directory, copy it as-is
if [[ -d "$file" ]]; then
inst_dir "$file"
else
inst "$file"
fi
}

install_debian_systemd() {
dinfo "Install debian systemd"

local files
local deb file

while read -r deb; do
files="$(dpkg-query -L "$deb" 2>/dev/null)" || continue
ddebug "Install debian files from package $deb"
for file in $files; do
[ -e "$file" ] || continue
[ ! -L "$file" ] && [ -d "$file" ] && continue
inst "$file"
done
while read -r file; do
install_package_file "$file"
done < <(dpkg-query -L "$deb" 2>/dev/null)
done < <(grep -E '^Package:' "${SOURCE_DIR}/debian/control" | cut -d ':' -f 2)
}

Expand All @@ -1354,17 +1370,7 @@ install_rpm() {

dinfo "Installing contents of RPM $rpm"
while read -r file; do
# Skip missing files (like /etc/machine-info)
[[ ! -e "$file" ]] && continue
# Skip directories unless they are a symlink (both -L and -d pass in this case)
[[ -d "$file" && ! -L "$file" ]] && continue
# Skip python unit tests, since the image_install machinery will try to pull
# in the whole python stack in a very questionable state, making the tests fail.
# And given we're trying to transition to mkosi-based images anyway I'm not even
# going to bother
[[ "$file" =~ /tests/unit-tests/.*.py$ ]] && continue

image_install "$file"
install_package_file "$file"
done < <(rpm -ql "$rpm")
}

Expand Down Expand Up @@ -3339,9 +3345,10 @@ test_create_image() {
}

test_setup() {
if get_bool "${TEST_REQUIRE_INSTALL_TESTS:?}" && \
command -v meson >/dev/null && \
[[ "$(meson configure "${BUILD_DIR:?}" | grep install-tests | awk '{ print $2 }')" != "true" ]]; then
if ! get_bool "$NO_BUILD" && \
get_bool "${TEST_REQUIRE_INSTALL_TESTS:?}" && \
command -v meson >/dev/null && \
[[ "$(meson configure "${BUILD_DIR:?}" | grep install-tests | awk '{ print $2 }')" != "true" ]]; then
dfatal "$BUILD_DIR needs to be built with -Dinstall-tests=true"
exit 1
fi
Expand Down
8 changes: 8 additions & 0 deletions test/units/testsuite-08.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ if systemd-detect-virt -qc; then
exit 1
fi

# This test requires systemd to run in the initrd as well, which is not the case
# for mkinitrd-based initrd (Ubuntu/Debian)
if [[ "$(systemctl show -P InitRDTimestampMonotonic)" -eq 0 ]]; then
echo "systemd didn't run in the initrd, skipping the test"
touch /skipped
exit 0
fi

# We should've created a mount under /run in initrd (see the other half of the test)
# that should've survived the transition from initrd to the real system
test -d /run/initrd-mount-target
Expand Down
30 changes: 18 additions & 12 deletions test/units/testsuite-75.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ run() {
"$@" |& tee "$RUN_OUT"
}

run_delv() {
# Since [0] delv no longer loads /etc/(bind/)bind.keys by default, so we
# have to do that explicitly for each invocation
run delv -a /etc/bind.keys "$@"
}

disable_ipv6() {
sysctl -w net.ipv6.conf.all.disable_ipv6=1
}
Expand Down Expand Up @@ -359,15 +365,15 @@ grep -qF "unsigned.test IN MX 15 mail.unsigned.test" "$RUN_OUT"
# Check the trust chain (with and without systemd-resolved in between
# Issue: https://github.com/systemd/systemd/issues/22002
# PR: https://github.com/systemd/systemd/pull/23289
run delv @ns1.unsigned.test signed.test
run_delv @ns1.unsigned.test signed.test
grep -qF "; fully validated" "$RUN_OUT"
run delv signed.test
run_delv signed.test
grep -qF "; fully validated" "$RUN_OUT"

for addr in "${DNS_ADDRESSES[@]}"; do
run delv "@$addr" -t A mail.signed.test
run_delv "@$addr" -t A mail.signed.test
grep -qF "; fully validated" "$RUN_OUT"
run delv "@$addr" -t AAAA mail.signed.test
run_delv "@$addr" -t AAAA mail.signed.test
grep -qF "; fully validated" "$RUN_OUT"
done
run resolvectl query mail.signed.test
Expand Down Expand Up @@ -405,7 +411,7 @@ grep -qF "10.0.0.123" "$RUN_OUT"
grep -qF "fd00:dead:beef:cafe::123" "$RUN_OUT"
grep -qF "authenticated: yes" "$RUN_OUT"
# Check OPENPGPKEY support
run delv -t OPENPGPKEY 5a786cdc59c161cdafd818143705026636962198c66ed4c5b3da321e._openpgpkey.signed.test
run_delv -t OPENPGPKEY 5a786cdc59c161cdafd818143705026636962198c66ed4c5b3da321e._openpgpkey.signed.test
grep -qF "; fully validated" "$RUN_OUT"
run resolvectl openpgp mr.smith@signed.test
grep -qF "5a786cdc59c161cdafd818143705026636962198c66ed4c5b3da321e._openpgpkey.signed.test" "$RUN_OUT"
Expand All @@ -421,11 +427,11 @@ check_domain() {
local addr

for addr in "${DNS_ADDRESSES[@]}"; do
run delv "@$addr" -t "$record" "$domain"
run_delv "@$addr" -t "$record" "$domain"
grep -qF "$message" "$RUN_OUT"
done

run delv -t "$record" "$domain"
run_delv -t "$record" "$domain"
grep -qF "$message" "$RUN_OUT"

run resolvectl query "$domain"
Expand Down Expand Up @@ -461,9 +467,9 @@ grep -qE "^follow14\.final\.signed\.test\..+IN\s+NSEC\s+" "$RUN_OUT"
# Check the trust chain (with and without systemd-resolved in between
# Issue: https://github.com/systemd/systemd/issues/22002
# PR: https://github.com/systemd/systemd/pull/23289
run delv @ns1.unsigned.test sub.onlinesign.test
run_delv @ns1.unsigned.test sub.onlinesign.test
grep -qF "; fully validated" "$RUN_OUT"
run delv sub.onlinesign.test
run_delv sub.onlinesign.test
grep -qF "; fully validated" "$RUN_OUT"

run dig +short sub.onlinesign.test
Expand All @@ -477,11 +483,11 @@ run resolvectl query --legend=no -t TXT onlinesign.test
grep -qF 'onlinesign.test IN TXT "hello from onlinesign"' "$RUN_OUT"

for addr in "${DNS_ADDRESSES[@]}"; do
run delv "@$addr" -t A dual.onlinesign.test
run_delv "@$addr" -t A dual.onlinesign.test
grep -qF "10.0.0.135" "$RUN_OUT"
run delv "@$addr" -t AAAA dual.onlinesign.test
run_delv "@$addr" -t AAAA dual.onlinesign.test
grep -qF "fd00:dead:beef:cafe::135" "$RUN_OUT"
run delv "@$addr" -t ANY ipv6.onlinesign.test
run_delv "@$addr" -t ANY ipv6.onlinesign.test
grep -qF "fd00:dead:beef:cafe::136" "$RUN_OUT"
done
run resolvectl query dual.onlinesign.test
Expand Down