@@ -103,25 +103,37 @@ def test_systeminfo(host, docker_image):
103103@all_images
104104def test_ssh_service (host , docker_image ):
105105 service_name = ssh_pkg_info [docker_image ][2 ]
106- ssh = host .service (service_name )
106+ ssh_svc = host .service (service_name )
107107 # wait at max 10 seconds for ssh is running
108108 for _ in range (10 ):
109- if ssh .is_running :
109+ if ssh_svc .is_running :
110110 break
111111 time .sleep (1 )
112112 else :
113113 raise AssertionError ("ssh is not running" )
114114
115- assert ssh .is_enabled
115+ assert ssh_svc .is_enabled
116+
117+
118+ @all_images
119+ def test_systemdservice_exists (host , docker_image ):
120+ service_name = ssh_pkg_info [docker_image ][2 ]
121+ for name in [service_name , f"{ service_name } .service" ]:
122+ ssh_svc = host .service (name )
123+ assert ssh_svc .exists
124+
125+ for name in ["non-existing" , "non-existing.service" , "non-existing.timer" ]:
126+ non_existing_service = host .service (name )
127+ assert not non_existing_service .exists
116128
117129
118130def test_service_systemd_mask (host ):
119- ssh = host .service ("ssh" )
120- assert not ssh .is_masked
131+ ssh_svc = host .service ("ssh" )
132+ assert not ssh_svc .is_masked
121133 host .run ("systemctl mask ssh" )
122- assert ssh .is_masked
134+ assert ssh_svc .is_masked
123135 host .run ("systemctl unmask ssh" )
124- assert not ssh .is_masked
136+ assert not ssh_svc .is_masked
125137
126138
127139def test_salt (host ):
0 commit comments