@@ -116,25 +116,37 @@ def test_systeminfo(host, docker_image):
116116@all_images
117117def test_ssh_service (host , docker_image ):
118118 service_name = ssh_pkg_info [docker_image ][2 ]
119- ssh = host .service (service_name )
119+ ssh_svc = host .service (service_name )
120120 # wait at max 10 seconds for ssh is running
121121 for _ in range (10 ):
122- if ssh .is_running :
122+ if ssh_svc .is_running :
123123 break
124124 time .sleep (1 )
125125 else :
126126 raise AssertionError ("ssh is not running" )
127127
128- assert ssh .is_enabled
128+ assert ssh_svc .is_enabled
129+
130+
131+ @all_images
132+ def test_systemdservice_exists (host , docker_image ):
133+ service_name = ssh_pkg_info [docker_image ][2 ]
134+ for name in [service_name , f"{ service_name } .service" ]:
135+ ssh_svc = host .service (name )
136+ assert ssh_svc .exists
137+
138+ for name in ["non-existing" , "non-existing.service" , "non-existing.timer" ]:
139+ non_existing_service = host .service (name )
140+ assert not non_existing_service .exists
129141
130142
131143def test_service_systemd_mask (host ):
132- ssh = host .service ("ssh" )
133- assert not ssh .is_masked
144+ ssh_svc = host .service ("ssh" )
145+ assert not ssh_svc .is_masked
134146 host .run ("systemctl mask ssh" )
135- assert ssh .is_masked
147+ assert ssh_svc .is_masked
136148 host .run ("systemctl unmask ssh" )
137- assert not ssh .is_masked
149+ assert not ssh_svc .is_masked
138150
139151
140152def test_salt (host ):
0 commit comments