Skip to content

Commit 9367b93

Browse files
committed
Skip snapshot test when missing qemu-img
Since the commit the remove AMI snapshot format special casing has merged, we're now running the libvirt snapshot tests as expected. However, for those tests qemu-img binary needs to be installed. Because these tests have been silently and incorrectly skipped for so long, they didn't receive the same maintenance as other tests as the failures went unnoticed. Change-Id: Ia90eedbe35f4ab2b200bdc90e0e35e5a86cc2110 Closes-bug: #2075178 Signed-off-by: Julien Le Jeune <[email protected]> (cherry picked from commit 0809f75) (cherry picked from commit cd4e581) (cherry picked from commit f58e8df)
1 parent 6b78420 commit 9367b93

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

nova/tests/unit/virt/test_virt_drivers.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import netaddr
2222
import os_resource_classes as orc
2323
import os_vif
24+
from oslo_concurrency import processutils
2425
from oslo_log import log as logging
2526
from oslo_serialization import jsonutils
2627
from oslo_utils import importutils
@@ -239,8 +240,16 @@ def test_snapshot_not_running(self):
239240
def test_snapshot_running(self):
240241
img_ref = self.image_service.create(self.ctxt, {'name': 'snap-1'})
241242
instance_ref, network_info = self._get_running_instance()
242-
self.connection.snapshot(self.ctxt, instance_ref, img_ref['id'],
243-
lambda *args, **kwargs: None)
243+
# this test depends on qemu-img
244+
# being installed and in the path,
245+
# if it is not installed, skip
246+
try:
247+
self.connection.snapshot(self.ctxt, instance_ref, img_ref['id'],
248+
lambda *args, **kwargs: None)
249+
except processutils.ProcessExecutionError as e:
250+
if 'qemu-img' in e.stderr and 'No such file' in e.stderr:
251+
self.skipTest("qemu-img not installed")
252+
raise e
244253

245254
@catch_notimplementederror
246255
def test_reboot(self):

0 commit comments

Comments
 (0)