Merge "Fix the service entry of evaluator and notifier"

This commit is contained in:
Jenkins 2015-07-27 13:46:13 +00:00 committed by Gerrit Code Review
commit f06820cf9b
2 changed files with 39 additions and 2 deletions

View File

@ -18,6 +18,8 @@
from oslo_config import cfg
from oslo_service import service as os_service
from aodh import evaluator as evaluator_svc
from aodh import notifier as notifier_svc
from aodh import service
CONF = cfg.CONF
@ -25,9 +27,9 @@ CONF = cfg.CONF
def notifier():
service.prepare_service()
os_service.launch(CONF, service.AlarmNotifierService(CONF)).wait()
os_service.launch(CONF, notifier_svc.AlarmNotifierService(CONF)).wait()
def evaluator():
service.prepare_service()
os_service.launch(CONF, service.AlarmEvaluationService(CONF)).wait()
os_service.launch(CONF, evaluator_svc.AlarmEvaluationService(CONF)).wait()

View File

@ -166,3 +166,38 @@ class BinApiTestCase(base.BaseTestCase):
if six.PY3:
content = content.decode('utf-8')
self.assertEqual([], json.loads(content))
class BinEvaluatorTestCase(base.BaseTestCase):
def setUp(self):
super(BinEvaluatorTestCase, self).setUp()
content = ("[DEFAULT]\n"
"rpc_backend=fake\n"
"[database]\n"
"connection=log://localhost\n")
if six.PY3:
content = content.encode('utf-8')
self.tempfile = fileutils.write_to_tempfile(content=content,
prefix='aodh',
suffix='.conf')
self.subp = None
def tearDown(self):
super(BinEvaluatorTestCase, self).tearDown()
if self.subp:
self.subp.kill()
os.remove(self.tempfile)
def test_starting_evaluator(self):
self.subp = subprocess.Popen(['aodh-evaluator',
"--config-file=%s" % self.tempfile],
stderr=subprocess.PIPE)
self.assertIsNone(self.subp.poll())
class BinNotifierTestCase(BinEvaluatorTestCase):
def test_starting_notifier(self):
self.subp = subprocess.Popen(['aodh-notifier',
"--config-file=%s" % self.tempfile],
stderr=subprocess.PIPE)
self.assertIsNone(self.subp.poll())