From 6f2355f17342d674f3c11107e3d2f9a505e975b5 Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Thu, 28 Sep 2023 11:58:23 +0100 Subject: [PATCH] Fix the common/ovn functional tests The __init__.py file was missing so these tests didn't run in the gate. This patch also fixes the test_sync_ha_chassis_group test itself. Change-Id: I21881f5d3a80d67dff7fe84e7a95d39a507d3b49 Signed-off-by: Lucas Alvares Gomes --- neutron/tests/functional/common/ovn/__init__.py | 0 neutron/tests/functional/common/ovn/test_utils.py | 14 ++++---------- 2 files changed, 4 insertions(+), 10 deletions(-) create mode 100644 neutron/tests/functional/common/ovn/__init__.py diff --git a/neutron/tests/functional/common/ovn/__init__.py b/neutron/tests/functional/common/ovn/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/tests/functional/common/ovn/test_utils.py b/neutron/tests/functional/common/ovn/test_utils.py index ffdd6869fab..abb05ca5c81 100644 --- a/neutron/tests/functional/common/ovn/test_utils.py +++ b/neutron/tests/functional/common/ovn/test_utils.py @@ -12,10 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from unittest import mock - -from oslo_utils import uuidutils - from neutron.common.ovn import constants as ovn_const from neutron.common.ovn import utils from neutron.tests.functional import base @@ -67,10 +63,8 @@ class TestCreateNeutronPgDrop(base.TestOVNFunctionalBase): class TestSyncHaChassisGroup(base.TestOVNFunctionalBase): def test_sync_ha_chassis_group(self): - plugin = mock.Mock() - plugin.get_network.return_value = {} - network_id = uuidutils.generate_uuid() - hcg_name = utils.ovn_name(network_id) + net = self._make_network(self.fmt, 'n1', True)['network'] + hcg_name = utils.ovn_name(net['id']) chassis1 = self.add_fake_chassis('host1', azs=[], enable_chassis_as_gw=True) chassis2 = self.add_fake_chassis('host2', azs=[], @@ -78,7 +72,7 @@ class TestSyncHaChassisGroup(base.TestOVNFunctionalBase): self.add_fake_chassis('host3') with self.nb_api.transaction(check_error=True) as txn: - utils.sync_ha_chassis_group(self.context, network_id, self.nb_api, + utils.sync_ha_chassis_group(self.context, net['id'], self.nb_api, self.sb_api, txn) ha_chassis = self.nb_api.db_find('HA_Chassis').execute( @@ -100,7 +94,7 @@ class TestSyncHaChassisGroup(base.TestOVNFunctionalBase): # HA Chassis Group register but will update the "ha_chassis" list. self.del_fake_chassis(chassis2) with self.nb_api.transaction(check_error=True) as txn: - utils.sync_ha_chassis_group(self.context, network_id, self.nb_api, + utils.sync_ha_chassis_group(self.context, net['id'], self.nb_api, self.sb_api, txn) ha_chassis = self.nb_api.db_find('HA_Chassis').execute(