Merge pull request #48719 from Ch3LL/service_mac_state

Enable service if disabled before running state service tests
This commit is contained in:
Nicole Thomas 2018-07-23 17:01:13 -04:00 committed by GitHub
commit 4b9f037d43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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