Skip to content

Commit 584accc

Browse files
committed
Auto-detect qemu-img qed support for unit tests
This will let downstream distros with qemu-img versions that don't support the qed format pass unit tests without having to patch this test out. Change-Id: I50907c90686366cab12be072b53c65b048b7c510 (cherry picked from commit 93ae58c)
1 parent 066fa00 commit 584accc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

glance/tests/unit/common/test_format_inspector.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,14 @@ def test_from_file_reads_minimum(self):
179179
# a local file.
180180
self.assertLess(fmt.actual_size, file_size)
181181

182+
def qed_supported(self):
183+
output = subprocess.check_output('qemu-img create --help', shell=True)
184+
return b' qed ' in output
185+
182186
def test_qed_always_unsafe(self):
187+
if not self.qed_supported():
188+
raise self.skipException('qed format not supported by qemu-img')
189+
183190
img = self._create_img('qed', 10 * units.Mi)
184191
fmt = format_inspector.get_inspector('qed').from_file(img)
185192
self.assertTrue(fmt.format_match)

0 commit comments

Comments
 (0)