From 616e5d965bd8a2923f00ba4ff194e6a6ee2468cd Mon Sep 17 00:00:00 2001 From: Akira Yoshiyama Date: Sun, 14 Apr 2013 11:39:55 +0000 Subject: Make nova-api use servicegroup.API.service_is_up(). Fix bug 1168861 Change-Id: I1e7e8f7519ec627b96736f74ee7123d101973544 --- nova/tests/api/openstack/compute/contrib/test_services.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/api/openstack/compute/contrib/test_services.py b/nova/tests/api/openstack/compute/contrib/test_services.py index 57dd056ee..387a5eb21 100644 --- a/nova/tests/api/openstack/compute/contrib/test_services.py +++ b/nova/tests/api/openstack/compute/contrib/test_services.py @@ -21,6 +21,7 @@ from nova import context from nova import db from nova import exception from nova.openstack.common import timeutils +from nova.servicegroup.drivers import db as db_driver from nova import test from nova.tests.api.openstack import fakes @@ -202,3 +203,13 @@ class ServicesTest(test.TestCase): res_dict = self.controller.update(req, "disable", body) self.assertEqual(res_dict['service']['status'], 'disabled') + + # This test is just to verify that the servicegroup API gets used when + # calling this API. + def test_services_with_exception(self): + def dummy_is_up(self, dummy): + raise KeyError() + + self.stubs.Set(db_driver.DbDriver, 'is_up', dummy_is_up) + req = FakeRequestWithHostService() + self.assertRaises(KeyError, self.controller.index, req) -- cgit