]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Do not assume order of dictionary elements in init_l3
authorCedric Brandily <zzelle@gmail.com>
Wed, 27 May 2015 17:57:04 +0000 (19:57 +0200)
committerCedric Brandily <zzelle@gmail.com>
Wed, 27 May 2015 17:57:04 +0000 (19:57 +0200)
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

index fe7cfca2f605205994397ee6ad867b83dc220340..ad08444c15732c2c20e9f5a1d924e356ad1a4cad 100644 (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',