From 668af3986888a2e2368d5d3fd01e674e849990e2 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 22 Mar 2012 14:40:10 +0100 Subject: Check that DescribeInstance works with deleted image This test checks that even if the image is non-existant, DescribeInstances returns correctly an answer and does not fails because of ImageNotFound". This has been the case previously (essex-4), and its now fixed with other another issue listed in bug #948286, but I wrote a test to be sure of that. Change-Id: I34df7a3fbc492f4418b2751b2b8bc527a7bbe335 Signed-off-by: Julien Danjou --- nova/tests/api/ec2/test_cloud.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nova/tests/api/ec2/test_cloud.py b/nova/tests/api/ec2/test_cloud.py index 9ddc7300d..6ac0ed07c 100644 --- a/nova/tests/api/ec2/test_cloud.py +++ b/nova/tests/api/ec2/test_cloud.py @@ -854,6 +854,23 @@ class CloudTestCase(test.TestCase): self.assertEqual(result1[0]['instanceId'], ec2utils.id_to_ec2_id(inst2.id)) + def test_describe_instances_with_image_deleted(self): + image_uuid = 'aebef54a-ed67-4d10-912f-14455edce176' + args1 = {'reservation_id': 'a', + 'image_ref': image_uuid, + 'instance_type_id': 1, + 'host': 'host1', + 'vm_state': 'active'} + inst1 = db.instance_create(self.context, args1) + args2 = {'reservation_id': 'b', + 'image_ref': image_uuid, + 'instance_type_id': 1, + 'host': 'host1', + 'vm_state': 'active'} + inst2 = db.instance_create(self.context, args2) + result = self.cloud.describe_instances(self.context) + self.assertEqual(len(result['reservationSet']), 2) + def _block_device_mapping_create(self, instance_id, mappings): volumes = [] for bdm in mappings: -- cgit