Tests don't correctly cleanup in case of an error

Bug #1723725 reported by Michel Peterson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
networking-bgpvpn
New
Undecided
Unassigned

Bug Description

There are several contexts that are affected. An example is the `bgpvpn()` context [1], where the yield [2] is not surrounded by a correct error management and therefore if a test asserts an error and it fails to assert the bgpvpn won't get deleted, as the delete is after the yield.

[1]: https://github.com/openstack/networking-bgpvpn/blob/master/networking_bgpvpn/tests/unit/services/test_plugin.py#L116
[2] https://github.com/openstack/networking-bgpvpn/blob/master/networking_bgpvpn/tests/unit/services/test_plugin.py#L130

This should be modified to something like

"""
try:
    yield bgpvpn
finally:
    self.__delete(...)
"""

This same fix should be applied to all affected contexts.

Revision history for this message
Cedric Savignan (csavignan) wrote :

The autodeletion is not mandatory? The database is deleted after each test?
https://specs.openstack.org/openstack/neutron-specs/specs/juno/remove-unit-test-autodeletion.html

Revision history for this message
Michel Peterson (mpeterson) wrote :

Even if that's the case, the codebase is not following the guidelines there. Disregarding that, for example in the case of networking-odl this has a real impact, since ODL is not part of the cleanup of that DB; but I guess this needs to be contemplated in networking-odl, given the document you pointed to.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.