fix race in test_interface_detach_with_port_with_bandwidth_request
During port detach the unbind towards neutron happens before the port allocation is removed from placement. The functional test only waited for the port unbind before asserted the remaining allocations and therefore it was racy. Fortunately the instance.interface_detach.end is emitted after the both the unbind and the allocation shrink. So the test is changed to wait for this notification instead. Change-Id: I53d76d6353ae634e387672e14943f518955b221e Closes-Bug: #1819374
This commit is contained in:
parent
f853e04cd2
commit
d52c8fea06
|
@ -355,14 +355,6 @@ class InstanceHelperMixin(object):
|
|||
self.fail('Timed out waiting for migration with status "%s" for '
|
||||
'instance: %s' % (expected_statuses, server['id']))
|
||||
|
||||
def _wait_for_port_unbind(self, neutron, port_id, retries=10):
|
||||
for attempt in range(retries):
|
||||
port = neutron.show_port(port_id)['port']
|
||||
if port['binding:host_id'] is None:
|
||||
return port
|
||||
time.sleep(0.5)
|
||||
self.fail('Timed out waiting for port %s to be unbound' % port_id)
|
||||
|
||||
|
||||
class ProviderUsageBaseTestCase(test.TestCase, InstanceHelperMixin):
|
||||
"""Base test class for functional tests that check provider usage
|
||||
|
|
|
@ -6465,8 +6465,8 @@ class PortResourceRequestBasedSchedulingTest(
|
|||
self.api.detach_interface(
|
||||
server['id'], self.neutron.port_with_resource_request['id'])
|
||||
|
||||
self._wait_for_port_unbind(
|
||||
self.neutron, self.neutron.port_with_resource_request['id'])
|
||||
fake_notifier.wait_for_versioned_notifications(
|
||||
'instance.interface_detach.end')
|
||||
|
||||
updated_port = self.neutron.show_port(
|
||||
self.neutron.port_with_resource_request['id'])['port']
|
||||
|
|
Loading…
Reference in New Issue