Fix TestNeutronv2.test_deallocate_for_instance_2* race failures
The unit tests test_deallocate_for_instance_2_with_requested test_deallocate_for_instance_2 in nova.tests.unit.network.test_neutronv2.TestNeutronv2 fail randomly. An example error looks like this: b'mox3.mox.UnexpectedMethodCallError: Unexpected method call. unexpected:- expected:+' b"- Client.delete_port('my_portid1') -> None" b'? ^' b"+ Client.delete_port('my_portid2') -> None" b'? This is due to the mox record with expected the deletion of multiple ports on an instance in a specific order. This order is not important though and also not the same in each test case execution. To make it explicit in the test case, that the order is *not* important, I've chosen to define that in the mock records with "InAnyOrder()". Another solution could have been to ensure the order of the port IDs through the unit tests, but that could be interpreted as a precondition for the functional code to work correctly, which is a wrong assumption and therefore not chosen for this fix. Closes-Bug: 1521599 Change-Id: I6ee4512d221aed48ee56f6cca19744f20f70cbe0
This commit is contained in:
parent
8a93fd1378
commit
94b40cf43c
|
@ -1424,7 +1424,7 @@ class TestNeutronv2(TestNeutronv2Base):
|
|||
for net, fip, port, request_id in requested_networks:
|
||||
self.moxed_client.update_port(port)
|
||||
for port in ports:
|
||||
self.moxed_client.delete_port(port)
|
||||
self.moxed_client.delete_port(port).InAnyOrder("delete_port_group")
|
||||
|
||||
self.mox.StubOutWithMock(api.db, 'instance_info_cache_update')
|
||||
api.db.instance_info_cache_update(self.context,
|
||||
|
|
Loading…
Reference in New Issue