Skip to content

Commit

Permalink
test/system: Try to handle /etc/resolv.conf on host as absolute symlink
Browse files Browse the repository at this point in the history
Some Arch Linux hosts have /etc/resolv.conf as an absolute symbolic link
to /run/systemd/resolve/stub-resolv.conf, instead of being a relative
symbolic link to ../run/systemd/resolve/stub-resolv.conf or a regular
file.  eg., the images built by arch-boxes [1].

This changes the target that the Toolbx container's /etc/resolv.conf
points at and confuses the tests [2].

Ideally, these host operating systems should be fixed to use relative
symbolic links.  This is highlighted by skipping the tests, because
there's no point in failing them until that happens.

This is a step towards running the CI on Arch Linux.

[1] https://gitlab.archlinux.org/archlinux/arch-boxes
    https://geo.mirror.pkgbuild.com/images/latest/

[2] Commit 88a95b0
    88a95b07af335be2
    #187

#1438
  • Loading branch information
debarshiray committed Nov 18, 2024
1 parent f900585 commit b378596
Showing 1 changed file with 49 additions and 7 deletions.
56 changes: 49 additions & 7 deletions test/system/203-network.bats
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ teardown() {
run --keep-empty-lines --separate-stderr "$TOOLBX" run readlink /etc/resolv.conf

assert_success
assert_line --index 0 "/run/host/etc/resolv.conf"

if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
skip "host has absolute symlink"
else
assert_line --index 0 "/run/host/etc/resolv.conf"
fi

assert [ ${#lines[@]} -eq 1 ]

# shellcheck disable=SC2154
Expand All @@ -83,7 +89,13 @@ teardown() {
run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro arch readlink /etc/resolv.conf

assert_success
assert_line --index 0 "/run/host/etc/resolv.conf"

if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
skip "host has absolute symlink"
else
assert_line --index 0 "/run/host/etc/resolv.conf"
fi

assert [ ${#lines[@]} -eq 1 ]

# shellcheck disable=SC2154
Expand All @@ -97,7 +109,13 @@ teardown() {
run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro fedora --release 34 readlink /etc/resolv.conf

assert_success
assert_line --index 0 "/run/host/etc/resolv.conf"

if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
skip "host has absolute symlink"
else
assert_line --index 0 "/run/host/etc/resolv.conf"
fi

assert [ ${#lines[@]} -eq 1 ]

# shellcheck disable=SC2154
Expand All @@ -111,7 +129,13 @@ teardown() {
run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro rhel --release 8.10 readlink /etc/resolv.conf

assert_success
assert_line --index 0 "/run/host/etc/resolv.conf"

if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
skip "host has absolute symlink"
else
assert_line --index 0 "/run/host/etc/resolv.conf"
fi

assert [ ${#lines[@]} -eq 1 ]

# shellcheck disable=SC2154
Expand All @@ -125,7 +149,13 @@ teardown() {
run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro ubuntu --release 16.04 readlink /etc/resolv.conf

assert_success
assert_line --index 0 "/run/host/etc/resolv.conf"

if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
skip "host has absolute symlink"
else
assert_line --index 0 "/run/host/etc/resolv.conf"
fi

assert [ ${#lines[@]} -eq 1 ]

# shellcheck disable=SC2154
Expand All @@ -139,7 +169,13 @@ teardown() {
run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro ubuntu --release 18.04 readlink /etc/resolv.conf

assert_success
assert_line --index 0 "/run/host/etc/resolv.conf"

if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
skip "host has absolute symlink"
else
assert_line --index 0 "/run/host/etc/resolv.conf"
fi

assert [ ${#lines[@]} -eq 1 ]

# shellcheck disable=SC2154
Expand All @@ -153,7 +189,13 @@ teardown() {
run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro ubuntu --release 20.04 readlink /etc/resolv.conf

assert_success
assert_line --index 0 "/run/host/etc/resolv.conf"

if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
skip "host has absolute symlink"
else
assert_line --index 0 "/run/host/etc/resolv.conf"
fi

assert [ ${#lines[@]} -eq 1 ]

# shellcheck disable=SC2154
Expand Down

0 comments on commit b378596

Please sign in to comment.