[Kimchi-devel] [PATCH v2 2/5] Clean up test pool directories
Crístian Viana
vianac at linux.vnet.ibm.com
Fri Nov 7 00:30:02 UTC 2014
During tests, some storage pools are created locally and their
directories are left behind in the system. The pool itself is removed
from libvirt, but the directory remains.
Remove the test storage pools directories after the tests are finished.
Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
---
tests/test_model.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/test_model.py b/tests/test_model.py
index d8c904e..bd41c79 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -492,6 +492,8 @@ class ModelTests(unittest.TestCase):
num = len(pools) + 1
inst.storagepools_create(poolDef)
+ if poolDef['type'] == 'dir':
+ rollback.prependDefer(shutil.rmtree, poolDef['path'])
rollback.prependDefer(inst.storagepool_delete, name)
pools = inst.storagepools_get_list()
@@ -548,6 +550,7 @@ class ModelTests(unittest.TestCase):
'path': path,
'type': 'dir'}
inst.storagepools_create(args)
+ rollback.prependDefer(shutil.rmtree, args['path'])
rollback.prependDefer(inst.storagepool_delete, pool)
self.assertRaises(InvalidOperation, inst.storagevolumes_get_list,
@@ -657,6 +660,7 @@ class ModelTests(unittest.TestCase):
'path': path,
'type': 'dir'}
inst.storagepools_create(args)
+ rollback.prependDefer(shutil.rmtree, args['path'])
rollback.prependDefer(inst.storagepool_delete, pool)
inst.template_update('test', params)
@@ -1373,6 +1377,8 @@ class ModelTests(unittest.TestCase):
'path': '/tmp/kimchi-images',
'type': 'kimchi-iso'}
inst.storagepools_create(args)
+ rollback.prependDefer(shutil.rmtree, '/tmp/kimchi-images')
+ rollback.prependDefer(shutil.rmtree, args['path'])
rollback.prependDefer(inst.storagepool_deactivate, args['name'])
time.sleep(1)
--
1.9.3
More information about the Kimchi-devel
mailing list