Add unit test coverage for bug 1000261.
The fix for bug 1000261 updated some parsing code to handle updated output from qemu-img. This test case exercises this parsing code. Change-Id: I5c9592478823464317cc6d521b3240913e4ded92
This commit is contained in:
1 changed files with 23 additions and 0 deletions
@@ -2426,6 +2426,29 @@ disk size: 4.4M''', ''))
libvirt_utils.fetch_image(context, target, image_id,
user_id, project_id)
def test_get_disk_backing_file(self):
with_actual_path = False
def fake_execute(*args, **kwargs):
if with_actual_path:
return ("some\n"
"output\n"
"backing file: /foo/bar/baz (actual path: /a/b/c)\n"
"...\n"), ''
else:
return ("some\n"
"output\n"
"backing file: /foo/bar/baz\n"
"...\n"), ''
self.stubs.Set(utils, 'execute', fake_execute)
out = libvirt_utils.get_disk_backing_file('')
self.assertEqual(out, 'baz')
with_actual_path = True
out = libvirt_utils.get_disk_backing_file('')
self.assertEqual(out, 'c')
class LibvirtConnectionTestCase(test.TestCase):
"""Test for nova.virt.libvirt.connection.LibvirtConnection."""
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.