diff options
| author | Russell Bryant <rbryant@redhat.com> | 2013-01-11 17:33:32 -0500 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2013-01-11 18:06:57 -0500 |
| commit | 6f6d5bfccbf223c16dbbfc87d43e687fa9bb517c (patch) | |
| tree | eb503022e0b8018185faaf9763c0c1534fc8cca1 /nova/tests | |
| parent | e7d74ba42127978579fc0f53db19047e7b55323c (diff) | |
Add service_destroy to conductor.
This patch adds a service_destroy method to the conductor API. It is
used from nova.service for deleting the service record in kill(). If a
service has been marked as not having db access, the conductor API will
complete this operation via rpc.
Part of bp no-db-compute.
Change-Id: Ie2397a090290823c0a47aaea41f6900072d142b4
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/conductor/test_conductor.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py index a5d0f7fba..e3ef6072a 100644 --- a/nova/tests/conductor/test_conductor.py +++ b/nova/tests/conductor/test_conductor.py @@ -633,12 +633,19 @@ class ConductorAPITestCase(_BaseTestCase, test.TestCase): {'name': 'fake-inst'}, 'updated_at', 'asc') - def _test_stubbed(self, name, *args): + def _test_stubbed(self, name, *args, **kwargs): self.mox.StubOutWithMock(db, name) getattr(db, name)(self.context, *args).AndReturn('fake-result') + if name == 'service_destroy': + # TODO(russellb) This is a hack ... SetUp() starts the conductor() + # service. There is a cleanup step that runs after this test which + # also deletes the associated service record. This involves a call + # to db.service_destroy(), which we have stubbed out. + db.service_destroy(mox.IgnoreArg(), mox.IgnoreArg()) self.mox.ReplayAll() result = getattr(self.conductor, name)(self.context, *args) - self.assertEqual(result, 'fake-result') + self.assertEqual( + result, 'fake-result' if kwargs.get('returns', True) else None) def test_service_get_all(self): self._test_stubbed('service_get_all') @@ -658,6 +665,9 @@ class ConductorAPITestCase(_BaseTestCase, test.TestCase): def test_service_create(self): self._test_stubbed('service_create', {}) + def test_service_destroy(self): + self._test_stubbed('service_destroy', '', returns=False) + def test_ping(self): timeouts = [] calls = dict(count=0) |
