tests: regression test LVM listing code

The revisions listing code mistakes VM name suffix with volume name.

QubesOS/qubes-issues#4680
This commit is contained in:
Marek Marczykowski-Górecki 2019-01-05 04:18:06 +01:00
parent b08804e7c8
commit 4c4e008368
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -30,7 +30,10 @@ import tempfile
import unittest
import unittest.mock
import asyncio
import qubes.tests
import qubes.tests.storage
import qubes.storage
from qubes.storage.lvm import ThinPool, ThinVolume, qubes_lvm
@ -970,6 +973,20 @@ class TC_01_ThinPool(ThinPoolBase, qubes.tests.SystemTestCase):
with self.assertNotRaises(qubes.exc.QubesException):
self.loop.run_until_complete(vm.start())
def test_006_name_suffix_parse(self):
'''Regression test for #4680'''
vm1 = self.app.add_new_vm(cls=qubes.vm.appvm.AppVM,
name=self.make_vm_name('appvm'), label='red')
vm2 = self.app.add_new_vm(cls=qubes.vm.appvm.AppVM,
name=self.make_vm_name('appvm-root'), label='red')
self.loop.run_until_complete(asyncio.wait([
vm1.create_on_disk(pool=self.pool.name),
vm2.create_on_disk(pool=self.pool.name)]))
self.loop.run_until_complete(vm2.start())
self.loop.run_until_complete(vm2.shutdown(wait=True))
with self.assertNotRaises(ValueError):
vm1.volumes['root'].size
@skipUnlessLvmPoolExists
class TC_02_StorageHelpers(ThinPoolBase):
def setUp(self):