Skip to content

Commit 9060265

Browse files
F
1 parent 87cd7e5 commit 9060265

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

test/test_modules.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def test_service_systemd_mask(host, docker_image):
137137
assert not ssh.is_masked
138138

139139

140+
@all_images
140141
def test_service_systemd_ssh(host, docker_image):
141142
name = "sshd" if docker_image == "rockylinux9" else "ssh"
142143
ssh = host.service(name)
@@ -151,17 +152,38 @@ def test_service_systemd_root_mount(host):
151152
root = host.service("-.mount") # systemd unit for mounting /
152153
assert root.exists
153154
assert root.is_valid
154-
assert root.is_enabled
155155
assert root.is_running
156156

157157

158+
@pytest.mark.testinfra_hosts("docker://rockylinux9")
159+
@pytest.mark.xfail(
160+
reason='"systemctl is-enabled -- -.mount" fails even if "systemctl status" succeeds'
161+
)
162+
def test_service_systemd_root_mount_is_enabled(host):
163+
root = host.service("-.mount") # systemd unit for mounting /
164+
# is_enabled does not work in Rocky Linux 9
165+
# $ systemctl status -- -.mount
166+
# AssertionError: ● -.mount - Root Mount
167+
# Loaded: loaded
168+
# Active: active (mounted) since Wed 2025-04-16 21:03:04 UTC; 6s ago
169+
# Until: Wed 2025-04-16 21:03:04 UTC; 6s ago
170+
# Where: /
171+
# What: overlay
172+
#
173+
# Notice: journal has been rotated since unit was started, output may be incomplete.
174+
#
175+
# $ systemctl is-enabled -- -.mount
176+
# Failed to get unit file state for -.mount: No such file or directory
177+
assert not root.is_enabled
178+
179+
158180
@pytest.mark.testinfra_hosts("docker://rockylinux9")
159181
def test_service_systemd_tmp_mount(host):
160182
tmp = host.service("tmp.mount")
161183
assert tmp.exists
162184
assert tmp.is_valid
163-
assert tmp.is_enabled
164-
assert tmp.is_running
185+
assert not tmp.is_enabled
186+
assert not tmp.is_running
165187

166188

167189
def test_salt(host):

0 commit comments

Comments
 (0)