Do not assume order of dictionary elements in init_l3

This fixes the test_interface unit tests[1] that breaks with a
randomized PYTHONHASHSEED (see the bug report).

The test assumed that the init_l3 method from
neutron.agent.linux.interface had dictionary elements in a particular
order. Found with PYTHONHASHSEED=2.

The fix refactors the test case to handle unsorted dictionaries in
init_l3.

[1] neutron.tests.unit.agent.linux.test_interface.TestABCDriver

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: I1948593b4d7a0069ef060512942b548c74a6b369
This commit is contained in:
Cedric Brandily 2015-05-27 19:57:04 +02:00
parent d518307cef
commit e135bcea47
1 changed files with 2 additions and 1 deletions

View File

@ -184,7 +184,8 @@ class TestABCDriver(TestBase):
mock.call().addr.delete('2001:db8:a::123/64'),
mock.call().route.list_onlink_routes(constants.IP_VERSION_4),
mock.call().route.list_onlink_routes(constants.IP_VERSION_6),
mock.call().route.add_onlink_route('172.20.0.0/24')])
mock.call().route.add_onlink_route('172.20.0.0/24')],
any_order=True)
def test_l3_init_with_ipv6_delete_onlink_routes(self):
addresses = [dict(scope='global',