2012-09-17 19:34:50 +00:00
|
|
|
'''
|
|
|
|
Tests for the supervisord state
|
|
|
|
'''
|
2012-09-25 21:32:42 +00:00
|
|
|
import os
|
2012-09-17 19:34:50 +00:00
|
|
|
import integration
|
|
|
|
|
|
|
|
|
|
|
|
class SupervisordTest(integration.ModuleCase):
|
|
|
|
'''
|
|
|
|
Validate the supervisord states.
|
|
|
|
'''
|
2012-09-25 21:32:42 +00:00
|
|
|
def setUp(self):
|
|
|
|
super(SupervisordTest, self).setUp()
|
|
|
|
ret = self.run_function('cmd.has_exec', ['supervisorctl'])
|
|
|
|
if not ret:
|
|
|
|
self.skipTest('supervisor not installed')
|
|
|
|
if os.geteuid() != 0:
|
|
|
|
self.skipTest('you must be this root to run this test')
|
|
|
|
|
2012-09-17 19:34:50 +00:00
|
|
|
def test_start(self):
|
|
|
|
'''
|
|
|
|
supervisord.running restart = False
|
|
|
|
'''
|
|
|
|
ret = self.run_state('supervisord.running', name='null_service')
|
|
|
|
|
|
|
|
self.assertTrue(ret)
|
2012-09-27 19:04:18 +00:00
|
|
|
self.assertEqual(ret.items()[0][1]['result'], False)
|
2012-09-17 19:34:50 +00:00
|
|
|
|
|
|
|
def test_restart(self):
|
|
|
|
'''
|
|
|
|
supervisord.running restart = True
|
|
|
|
'''
|
|
|
|
ret = self.run_state(
|
|
|
|
'supervisord.running', name='null_service', restart=True)
|
|
|
|
|
|
|
|
self.assertTrue(ret)
|
2012-09-27 19:04:18 +00:00
|
|
|
self.assertEqual(ret.items()[0][1]['result'], False)
|
2012-09-24 08:45:31 +00:00
|
|
|
|
|
|
|
def test_stop(self):
|
|
|
|
'''
|
|
|
|
supervisord.dead
|
|
|
|
'''
|
|
|
|
ret = self.run_state(
|
|
|
|
'supervisord.dead', name='null_service')
|
|
|
|
|
|
|
|
self.assertTrue(ret)
|
2012-09-27 19:04:18 +00:00
|
|
|
self.assertEqual(ret.items()[0][1]['result'], False)
|