summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Danjou <julien.danjou@enovance.com>2012-03-22 14:40:10 +0100
committerJulien Danjou <julien.danjou@enovance.com>2012-03-30 10:45:38 +0200
commit668af3986888a2e2368d5d3fd01e674e849990e2 (patch)
tree02c9f2edd2cda158e1c0f6bb0155099c577142ff
parent75676812e867a36778fa5b1beb3d2dbfcb87bec2 (diff)
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 <julien@danjou.info>
-rw-r--r--nova/tests/api/ec2/test_cloud.py17
1 files changed, 17 insertions, 0 deletions
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: