Skip to content

Commit

Permalink
tests: add in-use storage pool removal test
Browse files Browse the repository at this point in the history
  • Loading branch information
marmarek committed Feb 27, 2019
1 parent 5aa4916 commit 7433f83
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions qubes/tests/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,18 @@ def test_004_add_remove_pool(self):
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))

0 comments on commit 7433f83

Please sign in to comment.