@@ -127,15 +127,63 @@ def test_ssh_service(host, docker_image):
127127 assert ssh .is_enabled
128128
129129
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 )
132133 assert not ssh .is_masked
133134 host .run ("systemctl mask ssh" )
134135 assert ssh .is_masked
135136 host .run ("systemctl unmask ssh" )
136137 assert not ssh .is_masked
137138
138139
140+ @all_images
141+ def test_service_systemd_ssh (host , docker_image ):
142+ name = "sshd" if docker_image == "rockylinux9" else "ssh"
143+ ssh_service = host .service (name )
144+ assert ssh_service .exists
145+ assert ssh_service .is_valid
146+ assert ssh_service .is_enabled
147+ assert ssh_service .is_running
148+
149+
150+ def test_service_systemd_root_mount (host ):
151+ root_mount_service = host .service ("-.mount" ) # systemd unit for mounting /
152+ assert root_mount_service .exists
153+ assert root_mount_service .is_valid
154+ assert root_mount_service .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_mount_service = host .service ("-.mount" ) # systemd unit for mounting /
176+ assert not root_mount_service .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+
139187def test_salt (host ):
140188 ssh_version = host .salt ("pkg.version" , "openssh-server" , local = True )
141189 assert ssh_version .startswith ("1:9.2" )
0 commit comments