How to use check_service_status method in lisa

Best Python code snippet using lisa_python

test_service.py

Source:test_service.py Github

copy

Full Screen

...50 self.skipTest("{0} is not installed".format(cmd_name))51 def tearDown(self):52 if self.post_srv_disable:53 self.run_function("service.disable", name=self.service_name)54 def check_service_status(self, exp_return):55 """56 helper method to check status of service57 """58 check_status = self.run_function("service.status", name=self.service_name)59 try:60 if not re.match(exp_return, check_status):61 self.fail("status of service is not returning correctly")62 except TypeError:63 if check_status is not exp_return:64 self.fail("status of service is not returning correctly")65 @slowTest66 def test_service_running(self):67 """68 test service.running state module69 """70 if self.run_function("service.status", name=self.service_name):71 stop_service = self.run_function("service.stop", name=self.service_name)72 self.assertTrue(stop_service)73 self.check_service_status(self.stopped)74 if salt.utils.platform.is_darwin():75 # make sure the service is enabled on macosx76 enable = self.run_function("service.enable", name=self.service_name)77 start_service = self.run_state("service.running", name=self.service_name)78 self.assertTrue(start_service)79 self.check_service_status(self.running)80 @slowTest81 def test_service_dead(self):82 """83 test service.dead state module84 """85 start_service = self.run_state("service.running", name=self.service_name)86 self.assertSaltTrueReturn(start_service)87 self.check_service_status(self.running)88 ret = self.run_state("service.dead", name=self.service_name)89 self.assertSaltTrueReturn(ret)90 self.check_service_status(self.stopped)91 @slowTest92 def test_service_dead_init_delay(self):93 """94 test service.dead state module with init_delay arg95 """96 start_service = self.run_state("service.running", name=self.service_name)97 self.assertSaltTrueReturn(start_service)98 self.check_service_status(self.running)99 ret = self.run_state(100 "service.dead", name=self.service_name, init_delay=INIT_DELAY101 )102 self.assertSaltTrueReturn(ret)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful