From: Aaron Rosen Date: Wed, 7 Aug 2013 18:24:01 +0000 (-0700) Subject: Fix some NVP tests do not do cleanup of nvp ports X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=2e7f35c88b0192f553be34f973f35d39927f1746;p=openstack-build%2Fneutron-build.git Fix some NVP tests do not do cleanup of nvp ports Some of the NVP test do not execute self.addCleanup(self.fc.reset_all) from setUp() as NiciraPluginV2TestCase is not the first mixin. This casuses left over ports to still exist between different testcases. This patch only fixes this issue for TestNiciraPortsV2 and NiciraPortSecurityTestCaseas, some of the other tests require the setUp() for the first mixin to be called for their tests to work. Note: this is why the tests for the Remove DHCP lease logic are failing. Fixes bug: 1209355 Change-Id: I932471cdb8925353c5825cd70c8217511d6d7938 --- diff --git a/neutron/tests/unit/nicira/test_nicira_plugin.py b/neutron/tests/unit/nicira/test_nicira_plugin.py index 00746350c..8eeb72bd2 100644 --- a/neutron/tests/unit/nicira/test_nicira_plugin.py +++ b/neutron/tests/unit/nicira/test_nicira_plugin.py @@ -105,8 +105,8 @@ class TestNiciraV2HTTPResponse(test_plugin.TestV2HTTPResponse, pass -class TestNiciraPortsV2(test_plugin.TestPortsV2, - NiciraPluginV2TestCase, +class TestNiciraPortsV2(NiciraPluginV2TestCase, + test_plugin.TestPortsV2, test_bindings.PortBindingsTestCase): VIF_TYPE = portbindings.VIF_TYPE_OVS @@ -282,21 +282,22 @@ class NiciraPortSecurityTestCase(psec.PortSecurityDBTestCase): def setUp(self): test_lib.test_config['config_files'] = [get_fake_conf('nvp.ini.test')] # mock nvp api client - fc = fake_nvpapiclient.FakeClient(STUBS_PATH) + self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH) self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True) instance = self.mock_nvpapi.start() instance.return_value.login.return_value = "the_cookie" def _fake_request(*args, **kwargs): - return fc.fake_request(*args, **kwargs) + return self.fc.fake_request(*args, **kwargs) instance.return_value.request.side_effect = _fake_request super(NiciraPortSecurityTestCase, self).setUp(PLUGIN_NAME) + self.addCleanup(self.fc.reset_all) self.addCleanup(self.mock_nvpapi.stop) -class TestNiciraPortSecurity(psec.TestPortSecurity, - NiciraPortSecurityTestCase): +class TestNiciraPortSecurity(NiciraPortSecurityTestCase, + psec.TestPortSecurity): pass