[Kimchi-devel] [PATCH 5/8] Clean up test pool directories
Crístian Viana
vianac at linux.vnet.ibm.com
Mon Nov 3 01:05:26 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 | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tests/test_model.py b/tests/test_model.py
index 7f33540..21e1b6b 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -277,6 +277,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)
# Activate the pool before adding any volume
@@ -491,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()
@@ -547,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,
@@ -656,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)
@@ -1372,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