Enable service if disabled before running state service tests

This commit is contained in:
Ch3LL 2018-07-23 14:05:31 -04:00
parent b2431eab10
commit f44a2fc349
No known key found for this signature in database
GPG Key ID: 132B55A7C13EFA73

View File

@ -41,9 +41,19 @@ class ServiceTest(ModuleCase, SaltReturnAssertsMixin):
self.stopped = ''
self.running = '[0-9]'
self.pre_srv_enabled = True if self.service_name in self.run_function('service.get_enabled') else False
self.post_srv_disable = False
if not self.pre_srv_enabled:
self.run_function('service.enable', name=self.service_name)
self.post_srv_disable = True
if salt.utils.which(cmd_name) is None:
self.skipTest('{0} is not installed'.format(cmd_name))
def tearDown(self):
if self.post_srv_disable:
self.run_function('service.disable', name=self.service_name)
def check_service_status(self, exp_return):
'''
helper method to check status of service