Update nova notifier test after nova change

Nova's code path for cleaning up an instance was modified
to log errors to the database, but our tests don't set
up that part of the schema. Use patch to replace the
function that is trying to log the error.

The instance structure also expects to have a "system_metadata"
key in order to complete the cleanup, so add that to our
test data.

Change-Id: I4bc1d2c8b443a51cef8b13b0627010a6f06c42cf
Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
This commit is contained in:
Doug Hellmann 2013-01-28 11:35:05 -05:00
parent c6b09bb0b3
commit 60ae23b37d

View File

@ -120,7 +120,8 @@ class TestNovaNotifier(base.TestCase):
"access_ip_v4": "someip",
"access_ip_v6": "someip",
"metadata": {},
"uuid": "144e08f4-00cb-11e2-888e-5453ed1bbb5f"}
"uuid": "144e08f4-00cb-11e2-888e-5453ed1bbb5f",
"system_metadata": {}}
self.stubs.Set(db, 'instance_info_cache_delete', self.do_nothing)
self.stubs.Set(db, 'instance_destroy', self.do_nothing)
self.stubs.Set(db, 'instance_system_metadata_get',
@ -177,6 +178,7 @@ class TestNovaNotifier(base.TestCase):
@mock.patch('nova.conductor.api.API.instance_destroy')
@mock.patch('nova.conductor.api.API.block_device_mapping_destroy')
@mock.patch('nova.conductor.api.API.instance_update')
@mock.patch('nova.compute.utils.add_instance_fault_from_exc')
def run_test(*omit_args):
self.compute.terminate_instance(self.context,
instance=self.instance)