Skip to content

Commit b378596

Browse files
committedNov 18, 2024
test/system: Try to handle /etc/resolv.conf on host as absolute symlink
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 containers@88a95b07af335be2 containers#187 containers#1438
1 parent f900585 commit b378596

File tree

1 file changed

+49
-7
lines changed

1 file changed

+49
-7
lines changed
 

‎test/system/203-network.bats

+49-7
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ teardown() {
6969
run --keep-empty-lines --separate-stderr "$TOOLBX" run readlink /etc/resolv.conf
7070

7171
assert_success
72-
assert_line --index 0 "/run/host/etc/resolv.conf"
72+
73+
if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
74+
skip "host has absolute symlink"
75+
else
76+
assert_line --index 0 "/run/host/etc/resolv.conf"
77+
fi
78+
7379
assert [ ${#lines[@]} -eq 1 ]
7480

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

8591
assert_success
86-
assert_line --index 0 "/run/host/etc/resolv.conf"
92+
93+
if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
94+
skip "host has absolute symlink"
95+
else
96+
assert_line --index 0 "/run/host/etc/resolv.conf"
97+
fi
98+
8799
assert [ ${#lines[@]} -eq 1 ]
88100

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

99111
assert_success
100-
assert_line --index 0 "/run/host/etc/resolv.conf"
112+
113+
if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
114+
skip "host has absolute symlink"
115+
else
116+
assert_line --index 0 "/run/host/etc/resolv.conf"
117+
fi
118+
101119
assert [ ${#lines[@]} -eq 1 ]
102120

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

113131
assert_success
114-
assert_line --index 0 "/run/host/etc/resolv.conf"
132+
133+
if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
134+
skip "host has absolute symlink"
135+
else
136+
assert_line --index 0 "/run/host/etc/resolv.conf"
137+
fi
138+
115139
assert [ ${#lines[@]} -eq 1 ]
116140

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

127151
assert_success
128-
assert_line --index 0 "/run/host/etc/resolv.conf"
152+
153+
if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
154+
skip "host has absolute symlink"
155+
else
156+
assert_line --index 0 "/run/host/etc/resolv.conf"
157+
fi
158+
129159
assert [ ${#lines[@]} -eq 1 ]
130160

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

141171
assert_success
142-
assert_line --index 0 "/run/host/etc/resolv.conf"
172+
173+
if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
174+
skip "host has absolute symlink"
175+
else
176+
assert_line --index 0 "/run/host/etc/resolv.conf"
177+
fi
178+
143179
assert [ ${#lines[@]} -eq 1 ]
144180

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

155191
assert_success
156-
assert_line --index 0 "/run/host/etc/resolv.conf"
192+
193+
if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then
194+
skip "host has absolute symlink"
195+
else
196+
assert_line --index 0 "/run/host/etc/resolv.conf"
197+
fi
198+
157199
assert [ ${#lines[@]} -eq 1 ]
158200

159201
# shellcheck disable=SC2154

0 commit comments

Comments
 (0)