tests: add in-use storage pool removal test

QubesOS/qubes-issues#4454
This commit is contained in:
Marek Marczykowski-Górecki 2019-02-19 00:54:44 +01:00
parent 5aa49168e5
commit 7433f83581
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -149,3 +149,18 @@ class TC_00_Pool(QubesTestCase):
def assertPoolExists(self, pool):
""" Check if specified pool exists """
return pool in self.app.pools.keys()
def test_005_remove_used(self):
pool_name = 'test-pool-asdf'
dir_path = '/tmp/{}'.format(pool_name)
pool = self.loop.run_until_complete(
self.app.add_pool(name=pool_name,
driver='file',
dir_path=dir_path))
self.addCleanup(shutil.rmtree, dir_path)
vm = self.app.add_new_vm('StandaloneVM', label='red',
name=self.make_vm_name('vm'))
self.loop.run_until_complete(vm.create_on_disk(pool=pool))
with self.assertRaises(qubes.exc.QubesPoolInUseError):
self.loop.run_until_complete(self.app.remove_pool(pool_name))