From 41823a515dfe2e8eac32c5f23ef722042533be0d Mon Sep 17 00:00:00 2001 From: Stefan Nica Date: Mon, 14 Aug 2017 12:55:42 +0200 Subject: [PATCH] Fix test_check_simple_image_attributes to pass with AMI images Modify the ec2api.tests.functional.api.test_images.ImageTest.test_check_simple_image_attributes test case to allow AMI image types. Change-Id: Idc94f84977dacaf9e2a3d3968288bc4396507fff Closes-Bug: #1710597 --- ec2api/tests/functional/api/test_images.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ec2api/tests/functional/api/test_images.py b/ec2api/tests/functional/api/test_images.py index 0ab566c5..7f7bb60e 100644 --- a/ec2api/tests/functional/api/test_images.py +++ b/ec2api/tests/functional/api/test_images.py @@ -212,17 +212,26 @@ class ImageTest(base.EC2TestCase): @decorators.idempotent_id('b9aba1f7-0a7e-4717-b879-efe3bbea74e2') @testtools.skipUnless(CONF.aws.ebs_image_id, "EBS image id is not defined") def test_check_simple_image_attributes(self): + data = self.client.describe_images(ImageIds=[CONF.aws.ebs_image_id]) + base_image = data['Images'][0] + name = data_utils.rand_name('image') desc = data_utils.rand_name('desc for image') image_id, image_clean = self._create_image(name, desc) data = self.client.describe_image_attribute( ImageId=image_id, Attribute='kernel') - self.assertNotIn('KernelId', data) + if 'KernelId' in base_image: + self.assertIn('KernelId', data) + else: + self.assertNotIn('KernelId', data) data = self.client.describe_image_attribute( ImageId=image_id, Attribute='ramdisk') - self.assertNotIn('RamdiskId', data) + if 'RamdiskId' in base_image: + self.assertIn('RamdiskId', data) + else: + self.assertNotIn('RamdiskId', data) # description data = self.client.describe_image_attribute(