]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Add no_delete flag to UT router context manager
authorKevin Benton <blak111@gmail.com>
Sat, 21 Mar 2015 00:40:43 +0000 (17:40 -0700)
committerKevin Benton <blak111@gmail.com>
Sat, 21 Mar 2015 00:43:24 +0000 (17:43 -0700)
Adds a no_delete flag to the router context manager in
the unit tests to allow specific tests to avoid executing
all of the cleanup logic for floating IPs and interfaces
just to exit the test.

Ultimately, this should become the default once we are
comfortable that there is adequate explicit unit tests
for the deletion logic.

Change-Id: Iecbcc77b67b440d726fa6e703a87884e0b0df321

neutron/tests/unit/test_l3_plugin.py

index 7bf9e6f10d27faa2eabf5fae4f66f7387fb61fd3..56cba4177b50e1889db348e43018594c080bea20 100644 (file)
@@ -409,12 +409,14 @@ class L3NatTestCaseMixin(object):
     def router(self, name='router1', admin_state_up=True,
                fmt=None, tenant_id=_uuid(),
                external_gateway_info=None, set_context=False,
+               no_delete=False,
                **kwargs):
         router = self._make_router(fmt or self.fmt, tenant_id, name,
                                    admin_state_up, external_gateway_info,
                                    set_context, **kwargs)
         yield router
-        self._delete('routers', router['router']['id'])
+        if not no_delete:
+            self._delete('routers', router['router']['id'])
 
     def _set_net_external(self, net_id):
         self._update('networks', net_id,