From 3d41c31a02d399bcb3a2d8b8487bf3b1874fd7e1 Mon Sep 17 00:00:00 2001
From: Dan Smith <dansmith@redhat.com>
Date: Wed, 28 Aug 2024 07:00:16 -0700
Subject: [PATCH] Skip the glance vmdk-footer test for now

Glance did not initially support the vmdk-with-footer image format,
but will after it moves to the oslo version of format-inspector. So,
skip this test if it fails, to account for older versions.

Needed-By: https://review.opendev.org/c/openstack/glance/+/927291
Change-Id: Ieb20fc63ccc65769778e6303bd321837dc57169f
---
 tempest/api/image/v2/test_images_formats.py | 31 ++++++++++++---------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/tempest/api/image/v2/test_images_formats.py b/tempest/api/image/v2/test_images_formats.py
index 7ebc6857eb..48f13258f7 100644
--- a/tempest/api/image/v2/test_images_formats.py
+++ b/tempest/api/image/v2/test_images_formats.py
@@ -110,22 +110,25 @@ class ImagesFormatTest(base.BaseV2ImageTest,
         if not CONF.image_feature_enabled.image_conversion:
             self.skipTest('Import image_conversion not enabled')
 
-        glance_noconvert = [
-            # Glance does not support vmdk-sparse-with-footer with the
-            # in-tree format_inspector
-            'vmdk-sparse-with-footer',
-            ]
-        # Any images glance does not support in *conversion* for some
-        # reason will fail, even though the manifest marks them as usable.
-        expect_fail = any(x in self.imgdef['name']
-                          for x in glance_noconvert)
+        # VMDK with footer was not supported by earlier service versions,
+        # so we need to tolerate it passing and failing (skip for the latter).
+        # See this for more info:
+        # https://bugs.launchpad.net/glance/+bug/2073262
+        is_broken = 'footer' in self.imgdef['name']
 
         if (self.imgdef['format'] in CONF.image.disk_formats and
-                self.imgdef['usable'] and not expect_fail):
+                self.imgdef['usable']):
             # Usable images should end up in active state
             image = self._test_image(self.imgdef, asimport=True)
-            waiters.wait_for_image_status(self.client, image['id'],
-                                          'active')
+            try:
+                waiters.wait_for_image_status(self.client, image['id'],
+                                              'active')
+            except lib_exc.TimeoutException:
+                if is_broken:
+                    self.skipTest(
+                        'Older glance did not support vmdk-with-footer')
+                else:
+                    raise
         else:
             # FIXME(danms): Make this better, but gpt will fail before
             # the import even starts until glance has it in its API
@@ -164,7 +167,9 @@ class ImagesFormatTest(base.BaseV2ImageTest,
             self.skipTest(
                 'Format %s not allowed by config' % self.imgdef['format'])
 
-        # VMDK with footer is not supported by anyone yet until fixed:
+        # VMDK with footer was not supported by earlier service versions,
+        # so we need to tolerate it passing and failing (skip for the latter).
+        # See this for more info:
         # https://bugs.launchpad.net/glance/+bug/2073262
         is_broken = 'footer' in self.imgdef['name']