Fix neutron tests

Test test_handle_trunk_remove_trunk_manager_failure is trying
to connect to tcp:127.0.0.1:6640. This behaviour can be visible
by netcat while test is running. As this is unit test, it should
use mock, not real ovsdb. This patch is fixing this.

$ nc -l -p 6640
{"id":0,"method":"get_schema","params":["Open_vSwitch"]}

Change-Id: I25161913d701e15d127c70d71ac025e4573e81f1
This commit is contained in:
Michal Arbet 2020-05-14 19:08:23 +02:00
parent 08e9ec1b56
commit faead08d8f
1 changed files with 2 additions and 1 deletions

View File

@ -179,7 +179,8 @@ class TestOVSDBHandler(base.BaseTestCase):
self.ovsdb_handler.handle_trunk_add('foo')
self.assertFalse(has_port_mock.called)
def test_handle_trunk_remove_trunk_manager_failure(self):
@mock.patch('neutron.agent.common.ovs_lib.OVSBridge')
def test_handle_trunk_remove_trunk_manager_failure(self, br):
with mock.patch.object(self.ovsdb_handler, '_get_trunk_metadata',
side_effect=trunk_manager.TrunkManagerError(error='error')):
with mock.patch.object(ovsdb_handler, 'bridge_has_instance_port',