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
(cherry picked from commit 41823a515d)
This commit is contained in:
Stefan Nica 2017-08-14 12:55:42 +02:00
parent dbed9503af
commit 5a4305eb42
1 changed files with 11 additions and 2 deletions

View File

@ -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(