[Kimchi-devel] [PATCH 5/8] Clean up test pool directories

Aline Manera alinefm at linux.vnet.ibm.com
Mon Nov 3 17:37:37 UTC 2014


The tests fail with this patch.

On 11/03/2014 02:13 PM, Aline Manera wrote:
>
> Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>
>
> On 11/02/2014 11:05 PM, Crístian Viana wrote:
>> 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)
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel




More information about the Kimchi-devel mailing list