Skip to content

Commit ee0f3a3

Browse files
F
1 parent 87cd7e5 commit ee0f3a3

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

test/test_modules.py

Lines changed: 28 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)
@@ -146,22 +147,46 @@ def test_service_systemd_ssh(host, docker_image):
146147
assert ssh.is_running
147148

148149

150+
# service unit exists only in Rocky Linux 9
149151
@pytest.mark.testinfra_hosts("docker://rockylinux9")
150152
def test_service_systemd_root_mount(host):
151153
root = host.service("-.mount") # systemd unit for mounting /
152154
assert root.exists
153155
assert root.is_valid
154-
assert root.is_enabled
155156
assert root.is_running
156157

157158

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

166191

167192
def test_salt(host):

0 commit comments

Comments
 (0)