From 4bad9ec90c93cbb7d4d7b5c37870ec2ea4c05002 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 3 Oct 2024 07:03:37 -0700 Subject: [PATCH] Avoid lies about image format When glance checks the image content, our lies about images being in disk_formats[0] despite uploading random data get called out. This makes us honest about what we're going to upload, and skip if the bare/raw options are not available in config. Related to blueprint glance-as-defender Change-Id: Icb851e36b0083ab1ea217fd6c9f9f6b58ebecb08 --- glance_tempest_plugin/tests/rbac/v2/base.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/glance_tempest_plugin/tests/rbac/v2/base.py b/glance_tempest_plugin/tests/rbac/v2/base.py index dcd8cbb..c1e49a4 100644 --- a/glance_tempest_plugin/tests/rbac/v2/base.py +++ b/glance_tempest_plugin/tests/rbac/v2/base.py @@ -146,8 +146,15 @@ class ImageV2RbacImageTest(RbacBaseTests): def image(self, visibility=None): image = {} image['name'] = data_utils.rand_name('image') - image['container_format'] = CONF.image.container_formats[0] - image['disk_format'] = CONF.image.disk_formats[0] + # NOTE(danms): It's technically possible that bare/raw is not allowed, + # but this test suite cannot operate in that scenario since it does + # not have valid image data to upload. + if 'bare' not in CONF.image.container_formats: + self.skipTest('This test requires the "bare" container format') + if 'raw' not in CONF.image.disk_formats: + self.skipTest('This test requires the "raw" container format') + image['container_format'] = 'bare' + image['disk_format'] = 'raw' image['visibility'] = visibility if visibility else 'private' image['ramdisk_uuid'] = '00000000-1111-2222-3333-444455556666' return image