Fix trunk test_subport_delete functional test
This change fixes a race condition between deleting a subport in the trunk plugin and the actual deletion in the OVN NBDB. Change-Id: I836d47a1879d474c2171905416a2838cfe3bab5a Closes-Bug: #2067400
This commit is contained in:
@@ -19,12 +19,22 @@ from neutron_lib.objects import registry as obj_reg
|
||||
from neutron_lib.plugins import utils
|
||||
from neutron_lib.services.trunk import constants as trunk_consts
|
||||
from oslo_utils import uuidutils
|
||||
from ovsdbapp.backend.ovs_idl import event
|
||||
|
||||
from neutron.common.ovn import constants as ovn_const
|
||||
from neutron.services.trunk import plugin as trunk_plugin
|
||||
from neutron.tests.functional import base
|
||||
|
||||
|
||||
class WaitForLogicalSwitchPortUpdateEvent(event.WaitEvent):
|
||||
event_name = 'WaitForDataPathBindingCreateEvent'
|
||||
|
||||
def __init__(self):
|
||||
table = 'Logical_Switch_Port'
|
||||
events = (self.ROW_UPDATE,)
|
||||
super().__init__(events, table, None, timeout=15)
|
||||
|
||||
|
||||
class TestOVNTrunkDriver(base.TestOVNFunctionalBase):
|
||||
|
||||
def setUp(self):
|
||||
@@ -117,10 +127,14 @@ class TestOVNTrunkDriver(base.TestOVNFunctionalBase):
|
||||
def test_subport_delete(self):
|
||||
with self.subport() as subport:
|
||||
with self.trunk([subport]) as trunk:
|
||||
lsp_event = WaitForLogicalSwitchPortUpdateEvent()
|
||||
self.mech_driver.nb_ovn.idl.notify_handler.watch_events(
|
||||
(lsp_event,))
|
||||
self.trunk_plugin.remove_subports(self.context, trunk['id'],
|
||||
{'sub_ports': [subport]})
|
||||
new_trunk = self.trunk_plugin.get_trunk(self.context,
|
||||
trunk['id'])
|
||||
self.assertTrue(lsp_event.wait())
|
||||
self._verify_trunk_info(new_trunk, has_items=False)
|
||||
|
||||
def test_trunk_delete(self):
|
||||
|
||||
Reference in New Issue
Block a user