From 60ae23b37d794414f17d05fb129ac69aee4cf1e9 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Mon, 28 Jan 2013 11:35:05 -0500 Subject: [PATCH] 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 --- tests/compute/test_nova_notifier.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/compute/test_nova_notifier.py b/tests/compute/test_nova_notifier.py index b9c39fc75..017216d31 100644 --- a/tests/compute/test_nova_notifier.py +++ b/tests/compute/test_nova_notifier.py @@ -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)