From 9661b490c93c205cb23aaa283b8bf85d17bae86e Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Wed, 25 Jun 2014 06:12:43 +0000 Subject: [PATCH] UTs: Disable auto deletion of ports/subnets/nets Change the behavior of the unit test context managers for ports, networks, and subnets to skip the deletion of the objects they create. Adds explicit delete calls to the tests that require deletion of the objects. This is the first patch in a series to eliminate the automatic deletion of objects created during tests to improve test performance and make testing more explicit. Implements: blueprint remove-unit-test-autodeletion Change-Id: Ifc4490b121310ad64e18936e6fd94a2c9a1e36f2 --- neutron/tests/unit/db/vpn/test_db_vpnaas.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/neutron/tests/unit/db/vpn/test_db_vpnaas.py b/neutron/tests/unit/db/vpn/test_db_vpnaas.py index cb87c37d5..e4ecd45bd 100644 --- a/neutron/tests/unit/db/vpn/test_db_vpnaas.py +++ b/neutron/tests/unit/db/vpn/test_db_vpnaas.py @@ -271,6 +271,9 @@ class VPNTestMixin(object): if res.status_int >= 400: raise webob.exc.HTTPClientError( code=res.status_int, detail=vpnservice) + self._delete('subnets', public_sub['subnet']['id']) + if not subnet: + self._delete('subnets', tmp_subnet['subnet']['id']) def _create_ipsec_site_connection(self, fmt, name='test', peer_address='192.168.1.10', @@ -1132,6 +1135,7 @@ class TestVpnaas(VPNPluginDbTestCase): dpd) except webob.exc.HTTPClientError as ce: self.assertEqual(ce.code, expected_status_int) + self._delete('subnets', subnet['subnet']['id']) def test_create_ipsec_site_connection(self, **extras): """Test case to create an ipsec_site_connection.""" @@ -1256,6 +1260,7 @@ class TestVpnaas(VPNPluginDbTestCase): self.assertEqual(v, sorted(actual[k])) else: self.assertEqual(v, actual[k]) + self._delete('networks', subnet['subnet']['network_id']) def test_show_ipsec_site_connection(self): """Test case to show a ipsec_site_connection."""