From a3202f7bf9f1aecc7d0632011167d38a1698f0a0 Mon Sep 17 00:00:00 2001 From: Julien Le Jeune Date: Mon, 15 Jul 2024 14:10:43 +0200 Subject: [PATCH] Fix test_vmdk_bad_descriptor_mem_limit and test_vmdk_bad_descriptor_mem_limit_stream_optimized These tests depend on qemu-img being installed and in the path, if it is not installed, skip them. Change-Id: I896f16c512f24bcdd898ab002af4e5e068f66b64 Closes-bug: #2073862 Signed-off-by: Julien Le Jeune --- nova/tests/unit/image/test_format_inspector.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nova/tests/unit/image/test_format_inspector.py b/nova/tests/unit/image/test_format_inspector.py index 8406dfca3788..605b67c0ec03 100644 --- a/nova/tests/unit/image/test_format_inspector.py +++ b/nova/tests/unit/image/test_format_inspector.py @@ -179,10 +179,16 @@ class TestFormatInspectors(test.NoDBTestCase): shell=True) # Convert it to VMDK - subprocess.check_output( - 'qemu-img convert -f raw -O vmdk -o subformat=%s -S 0 %s %s' % ( - subformat, raw, fn), - shell=True) + # these tests depend on qemu-img + # being installed and in the path, + # if it is not installed, skip + try: + subprocess.check_output( + 'qemu-img convert -f raw -O vmdk -o subformat=%s -S 0 %s %s' + % (subformat, raw, fn), + shell=True) + except Exception: + self.skipTest("qemu-img not installed") return fn def _test_format_at_block_size(self, format_name, img, block_size):