[Libvirt-cim] [PATCH 3 of 3] [TEST] IPv6 Support test

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Dec 3 18:18:49 UTC 2009


Sharad Mishra wrote:
> 
>  > > +          
>  > > +    except Exception, detail:
>  > > +        logger.error("Exception: %s", detail)
>  > > +        status = FAIL
>  >
>  > Instead of calling undefine before each call to raise Exception(), why
>  > not put the undefine call in the except block?  This means you'll only
>  > need to call undefine() once for any exception.  And if this test case
>  > is extended in the future, it'll safe guard against an accidental
>  > exclusion of the undefine() call when an exception occurs.
> 
> There is an exception raised if define fails. We don't want to call 
> undefine if the VM wasn't defined.

Ah, agreed.  Although, many of test cases do this anyway.  Because we 
don't check the output of undefine() (except for certain occasions).  So 
the worst thing that happens is that the undefine() call returns an 
error.  And we get some additional negative testing in...  Generally, I 
prefer to make sure the cleanup happens in one place - that way it is 
easy to tell whether the test is cleaning up properly.

But this is a good point.  It's fine to leave it as is.




More information about the Libvirt-cim mailing list