This fixes the test_ancillary_bridges_multiple unit test that breaks with a randomized
PYTHONHASHSEED (see the bug report).
The test assumed that the device_ids set had
elements in a particular order. Found with PYTHONHASHSEED=
2455351445.
The fix refactors the pullup_side_effect function so that it checks if the
device_id exists before returning the bridge.
Partial-bug: #
1348818
Note: There are several other unrelated unit tests that also break with a
randomized PYTHONHASHSEED, but they are not addressed here. They will be
addressed in separate patches.
Change-Id: Ie6b44d1d820ebb186036ffcd04ea2104dd384e94
device_ids = ancillary[:]
def pullup_side_effect(self, *args):
- result = device_ids.pop(0)
- return result
+ # Check that the device_id exists, if it does return it
+ # if it does not return None
+ try:
+ device_ids.remove(args[0])
+ return args[0]
+ except Exception:
+ return None
with contextlib.nested(
mock.patch('neutron.plugins.openvswitch.agent.ovs_neutron_agent.'