@@ -127,15 +127,63 @@ def test_ssh_service(host, docker_image):
127
127
assert ssh .is_enabled
128
128
129
129
130
- def test_service_systemd_mask (host ):
131
- ssh = host .service ("ssh" )
130
+ def test_service_systemd_mask (host , docker_image ):
131
+ name = "sshd" if docker_image == "rockylinux9" else "ssh"
132
+ ssh = host .service (name )
132
133
assert not ssh .is_masked
133
134
host .run ("systemctl mask ssh" )
134
135
assert ssh .is_masked
135
136
host .run ("systemctl unmask ssh" )
136
137
assert not ssh .is_masked
137
138
138
139
140
+ @all_images
141
+ def test_service_systemd_ssh (host , docker_image ):
142
+ name = "sshd" if docker_image == "rockylinux9" else "ssh"
143
+ ssh = host .service (name )
144
+ assert ssh .exists
145
+ assert ssh .is_valid
146
+ assert ssh .is_enabled
147
+ assert ssh .is_running
148
+
149
+
150
+ def test_service_systemd_root_mount (host ):
151
+ root = host .service ("-.mount" ) # systemd unit for mounting /
152
+ assert root .exists
153
+ assert root .is_valid
154
+ assert root .is_running
155
+
156
+
157
+ # is_enabled does not work in Rocky Linux 9
158
+ # $ systemctl status -- -.mount
159
+ # AssertionError: ● -.mount - Root Mount
160
+ # Loaded: loaded
161
+ # Active: active (mounted) since Wed 2025-04-16 21:03:04 UTC; 6s ago
162
+ # Until: Wed 2025-04-16 21:03:04 UTC; 6s ago
163
+ # Where: /
164
+ # What: overlay
165
+ #
166
+ # Notice: journal has been rotated since unit was started, output may be incomplete.
167
+ #
168
+ # $ systemctl is-enabled -- -.mount
169
+ # Failed to get unit file state for -.mount: No such file or directory
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
+ assert not root .is_enabled
177
+
178
+
179
+ def test_service_systemd_tmp_mount (host ):
180
+ tmp = host .service ("tmp.mount" )
181
+ assert tmp .exists
182
+ assert tmp .is_valid
183
+ assert not tmp .is_enabled
184
+ assert not tmp .is_running
185
+
186
+
139
187
def test_salt (host ):
140
188
ssh_version = host .salt ("pkg.version" , "openssh-server" , local = True )
141
189
assert ssh_version .startswith ("1:9.2" )
0 commit comments