From 7433f835819addcdc876733a49bb7a2e40c00537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 19 Feb 2019 00:54:44 +0100 Subject: [PATCH] tests: add in-use storage pool removal test QubesOS/qubes-issues#4454 --- qubes/tests/storage.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qubes/tests/storage.py b/qubes/tests/storage.py index 9d573cf9..ccbf35b1 100644 --- a/qubes/tests/storage.py +++ b/qubes/tests/storage.py @@ -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))