@@ -116,25 +116,37 @@ def test_systeminfo(host, docker_image):
116
116
@all_images
117
117
def test_ssh_service (host , docker_image ):
118
118
service_name = ssh_pkg_info [docker_image ][2 ]
119
- ssh = host .service (service_name )
119
+ ssh_svc = host .service (service_name )
120
120
# wait at max 10 seconds for ssh is running
121
121
for _ in range (10 ):
122
- if ssh .is_running :
122
+ if ssh_svc .is_running :
123
123
break
124
124
time .sleep (1 )
125
125
else :
126
126
raise AssertionError ("ssh is not running" )
127
127
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
129
141
130
142
131
143
def 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
134
146
host .run ("systemctl mask ssh" )
135
- assert ssh .is_masked
147
+ assert ssh_svc .is_masked
136
148
host .run ("systemctl unmask ssh" )
137
- assert not ssh .is_masked
149
+ assert not ssh_svc .is_masked
138
150
139
151
140
152
def test_salt (host ):
0 commit comments