From e135bcea472e08347fc3dc3df01aa1fa909504fb Mon Sep 17 00:00:00 2001 From: Cedric Brandily Date: Wed, 27 May 2015 19:57:04 +0200 Subject: [PATCH] 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 --- neutron/tests/unit/agent/linux/test_interface.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neutron/tests/unit/agent/linux/test_interface.py b/neutron/tests/unit/agent/linux/test_interface.py index fe7cfca2f..ad08444c1 100644 --- a/neutron/tests/unit/agent/linux/test_interface.py +++ b/neutron/tests/unit/agent/linux/test_interface.py @@ -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', -- 2.45.2