@@ -103,25 +103,37 @@ def test_systeminfo(host, docker_image):
103
103
@all_images
104
104
def test_ssh_service (host , docker_image ):
105
105
service_name = ssh_pkg_info [docker_image ][2 ]
106
- ssh = host .service (service_name )
106
+ ssh_svc = host .service (service_name )
107
107
# wait at max 10 seconds for ssh is running
108
108
for _ in range (10 ):
109
- if ssh .is_running :
109
+ if ssh_svc .is_running :
110
110
break
111
111
time .sleep (1 )
112
112
else :
113
113
raise AssertionError ("ssh is not running" )
114
114
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
116
128
117
129
118
130
def 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
121
133
host .run ("systemctl mask ssh" )
122
- assert ssh .is_masked
134
+ assert ssh_svc .is_masked
123
135
host .run ("systemctl unmask ssh" )
124
- assert not ssh .is_masked
136
+ assert not ssh_svc .is_masked
125
137
126
138
127
139
def test_salt (host ):
0 commit comments