Merge "Correct exception args in vfs/guestfs."
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from nova import exception
|
||||||
from nova import test
|
from nova import test
|
||||||
|
|
||||||
from nova.tests import fakeguestfs
|
from nova.tests import fakeguestfs
|
||||||
@@ -51,6 +52,32 @@ class VirtDiskVFSGuestFSTest(test.TestCase):
|
|||||||
self.assertEqual(handle.closed, True)
|
self.assertEqual(handle.closed, True)
|
||||||
self.assertEqual(len(handle.mounts), 0)
|
self.assertEqual(len(handle.mounts), 0)
|
||||||
|
|
||||||
|
def test_appliance_setup_inspect_no_root_raises(self):
|
||||||
|
vfs = vfsimpl.VFSGuestFS(imgfile="/dummy.qcow2",
|
||||||
|
imgfmt="qcow2",
|
||||||
|
partition=-1)
|
||||||
|
# call setup to init the handle so we can stub it
|
||||||
|
vfs.setup()
|
||||||
|
|
||||||
|
def fake_inspect_os():
|
||||||
|
return []
|
||||||
|
|
||||||
|
self.stubs.Set(vfs.handle, 'inspect_os', fake_inspect_os)
|
||||||
|
self.assertRaises(exception.NovaException, vfs.setup_os_inspect)
|
||||||
|
|
||||||
|
def test_appliance_setup_inspect_multi_boots_raises(self):
|
||||||
|
vfs = vfsimpl.VFSGuestFS(imgfile="/dummy.qcow2",
|
||||||
|
imgfmt="qcow2",
|
||||||
|
partition=-1)
|
||||||
|
# call setup to init the handle so we can stub it
|
||||||
|
vfs.setup()
|
||||||
|
|
||||||
|
def fake_inspect_os():
|
||||||
|
return ['fake1', 'fake2']
|
||||||
|
|
||||||
|
self.stubs.Set(vfs.handle, 'inspect_os', fake_inspect_os)
|
||||||
|
self.assertRaises(exception.NovaException, vfs.setup_os_inspect)
|
||||||
|
|
||||||
def test_appliance_setup_static_nopart(self):
|
def test_appliance_setup_static_nopart(self):
|
||||||
vfs = vfsimpl.VFSGuestFS(imgfile="/dummy.qcow2",
|
vfs = vfsimpl.VFSGuestFS(imgfile="/dummy.qcow2",
|
||||||
imgfmt="qcow2",
|
imgfmt="qcow2",
|
||||||
|
|||||||
Reference in New Issue
Block a user