Merge "Fix the common/ovn functional tests"

This commit is contained in:
Zuul 2023-09-28 17:11:10 +00:00 committed by Gerrit Code Review
commit ea0bc376a2
2 changed files with 4 additions and 10 deletions

View File

@ -12,10 +12,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # 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 constants as ovn_const
from neutron.common.ovn import utils from neutron.common.ovn import utils
from neutron.tests.functional import base from neutron.tests.functional import base
@ -67,10 +63,8 @@ class TestCreateNeutronPgDrop(base.TestOVNFunctionalBase):
class TestSyncHaChassisGroup(base.TestOVNFunctionalBase): class TestSyncHaChassisGroup(base.TestOVNFunctionalBase):
def test_sync_ha_chassis_group(self): def test_sync_ha_chassis_group(self):
plugin = mock.Mock() net = self._make_network(self.fmt, 'n1', True)['network']
plugin.get_network.return_value = {} hcg_name = utils.ovn_name(net['id'])
network_id = uuidutils.generate_uuid()
hcg_name = utils.ovn_name(network_id)
chassis1 = self.add_fake_chassis('host1', azs=[], chassis1 = self.add_fake_chassis('host1', azs=[],
enable_chassis_as_gw=True) enable_chassis_as_gw=True)
chassis2 = self.add_fake_chassis('host2', azs=[], chassis2 = self.add_fake_chassis('host2', azs=[],
@ -78,7 +72,7 @@ class TestSyncHaChassisGroup(base.TestOVNFunctionalBase):
self.add_fake_chassis('host3') self.add_fake_chassis('host3')
with self.nb_api.transaction(check_error=True) as txn: 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) self.sb_api, txn)
ha_chassis = self.nb_api.db_find('HA_Chassis').execute( 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. # HA Chassis Group register but will update the "ha_chassis" list.
self.del_fake_chassis(chassis2) self.del_fake_chassis(chassis2)
with self.nb_api.transaction(check_error=True) as txn: 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) self.sb_api, txn)
ha_chassis = self.nb_api.db_find('HA_Chassis').execute( ha_chassis = self.nb_api.db_find('HA_Chassis').execute(