diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-01-12 09:19:05 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-01-12 09:19:05 +0000 |
| commit | e2ea2873949091ca6737419eb0cd0c1268bc437c (patch) | |
| tree | 3e7992a88d857beb5e21d959b774cbeafcfae7c9 /nova/tests | |
| parent | 2e2a20285db20092540f0bc76c7f9576d22a68f3 (diff) | |
| parent | 6f6d5bfccbf223c16dbbfc87d43e687fa9bb517c (diff) | |
Merge "Add service_destroy to conductor."
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) |
