[Kimchi-devel] [PATCH V3 3/4] add template_delete to rollback after create a template

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Thu Mar 20 17:42:30 UTC 2014


On 03/19/2014 06:23 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> We know ModelTests will tear down the template datebase.
> But it is better to delete the template explicitly.
> In this way, the test case also can test the template_delete.
>
> Also this can make pyflakes happy.
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> Signed-off-by: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
> ---
>   tests/test_model.py | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/tests/test_model.py b/tests/test_model.py
> index 60d0b94..a3bfe88 100644
> --- a/tests/test_model.py
> +++ b/tests/test_model.py
> @@ -513,6 +513,7 @@ class ModelTests(unittest.TestCase):
>               orig_params = {'name': 'test-template', 'memory': 1024,
>                              'cpus': 1, 'cdrom': self.kimchi_iso}
>               inst.templates_create(orig_params)
> +            rollback.prependDefer(inst.template_delete, 'test-template')
>               orig_temp = inst.template_lookup(orig_params['name'])
>
>               ident = inst.template_clone('test-template')
I think you should also add a rollback to delete the new clone template. 
Like:

         ident = inst.template_clone('test-template')
+      rollback.prependDefer(inst.template_delete, 'test-template-clone')




More information about the Kimchi-devel mailing list