tests: fix asyncio usage in storage_lvm.TC_01_ThinPool
Both vm.create_on_disk() and vm.start() are coroutines. Tests in this class didn't run them, so basically didn't test anything. Wrap couroutine calls with self.loop.run_until_complete(). Additionally, don't fail if LVM pool is named differently. In that case, the test is rather sily, as it probably use the same pool for source and destination (operation already tested elsewhere). But it isn't a reason for failing the test.
This commit is contained in:
parent
6170edb291
commit
299c514647
@ -946,26 +946,27 @@ class TC_01_ThinPool(ThinPoolBase, qubes.tests.SystemTestCase):
|
||||
vm = self.app.add_new_vm(qubes.vm.templatevm.TemplateVM, name=name,
|
||||
label='red')
|
||||
vm.clone_properties(template_vm)
|
||||
vm.clone_disk_files(template_vm, pool='test-lvm')
|
||||
self.loop.run_until_complete(
|
||||
vm.clone_disk_files(template_vm, pool=self.pool.name))
|
||||
for v_name, volume in vm.volumes.items():
|
||||
if volume.save_on_stop:
|
||||
expected = "/dev/{!s}/vm-{!s}-{!s}".format(
|
||||
DEFAULT_LVM_POOL.split('/')[0], vm.name, v_name)
|
||||
self.assertEqual(volume.path, expected)
|
||||
with self.assertNotRaises(qubes.exc.QubesException):
|
||||
vm.start()
|
||||
self.loop.run_until_complete(vm.start())
|
||||
|
||||
def test_005_create_appvm(self):
|
||||
vm = self.app.add_new_vm(cls=qubes.vm.appvm.AppVM,
|
||||
name=self.make_vm_name('appvm'), label='red')
|
||||
vm.create_on_disk(pool='test-lvm')
|
||||
self.loop.run_until_complete(vm.create_on_disk(pool=self.pool.name))
|
||||
for v_name, volume in vm.volumes.items():
|
||||
if volume.save_on_stop:
|
||||
expected = "/dev/{!s}/vm-{!s}-{!s}".format(
|
||||
DEFAULT_LVM_POOL.split('/')[0], vm.name, v_name)
|
||||
self.assertEqual(volume.path, expected)
|
||||
with self.assertNotRaises(qubes.exc.QubesException):
|
||||
vm.start()
|
||||
self.loop.run_until_complete(vm.start())
|
||||
|
||||
@skipUnlessLvmPoolExists
|
||||
class TC_02_StorageHelpers(ThinPoolBase):
|
||||
|
Loading…
Reference in New Issue
Block a user