Skip to content

Commit c3d2e0f

Browse files
committed
Use a different symlink target for AmazonLinux2023
/run/systemd/resolve/stub-resolv.conf is a symlink to /run/systemd/resolve/resolv.conf in AL2023, so in this case the /etc/resolv.conf symlink resolves to the former not the latter.
1 parent 69ab2cd commit c3d2e0f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

molecule/default/tests/test_default.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,18 @@ def test_symlink(host):
2525
"""Verify that /etc/resolv.conf is the expected symlink."""
2626
f = host.file("/etc/resolv.conf")
2727
assert f.is_symlink, "/etc/resolv.conf is not a symlink."
28+
29+
if host.system_info.distribution in ["amzn"]:
30+
# /run/systemd/resolve/stub-resolv.conf is a symlink to
31+
# /run/systemd/resolve/resolv.conf in AL2023, so the
32+
# /etc/resolv.conf symlink resolves to the former.
33+
symlink_target = "/run/systemd/resolve/resolv.conf"
34+
else:
35+
symlink_target = "/run/systemd/resolve/stub-resolv.conf"
36+
2837
assert (
29-
f.linked_to == "/run/systemd/resolve/stub-resolv.conf"
30-
), "/etc/resolv.conf is not a symlink to /run/systemd/resolve/stub-resolv.conf."
38+
f.linked_to == symlink_target
39+
), f"/etc/resolv.conf is not a symlink to {symlink_target}."
3140

3241

3342
def test_services(host):

0 commit comments

Comments
 (0)