Merge "Test guestfs without support for close_on_exit"
This commit is contained in:
commit
bd773a625c
|
@ -14,8 +14,12 @@
|
|||
|
||||
|
||||
class GuestFS(object):
|
||||
SUPPORT_CLOSE_ON_EXIT = True
|
||||
|
||||
def __init__(self, close_on_exit=True):
|
||||
def __init__(self, **kwargs):
|
||||
if not self.SUPPORT_CLOSE_ON_EXIT and 'close_on_exit' in kwargs:
|
||||
raise TypeError('close_on_exit')
|
||||
self.kwargs = kwargs
|
||||
self.drives = []
|
||||
self.running = False
|
||||
self.closed = False
|
||||
|
|
|
@ -202,3 +202,14 @@ class VirtDiskVFSGuestFSTest(test.NoDBTestCase):
|
|||
self.assertEqual(vfs.handle.files["/some/file"]["gid"], 600)
|
||||
|
||||
vfs.teardown()
|
||||
|
||||
def test_close_on_error(self):
|
||||
vfs = vfsimpl.VFSGuestFS(imgfile="/dummy.qcow2", imgfmt="qcow2")
|
||||
vfs.setup()
|
||||
self.assertFalse(vfs.handle.kwargs['close_on_exit'])
|
||||
vfs.teardown()
|
||||
self.stubs.Set(fakeguestfs.GuestFS, 'SUPPORT_CLOSE_ON_EXIT', False)
|
||||
vfs = vfsimpl.VFSGuestFS(imgfile="/dummy.qcow2", imgfmt="qcow2")
|
||||
vfs.setup()
|
||||
self.assertNotIn('close_on_exit', vfs.handle.kwargs)
|
||||
vfs.teardown()
|
||||
|
|
Loading…
Reference in New Issue