From: Bradley Jones Date: Mon, 20 Oct 2014 11:34:55 +0000 (+0100) Subject: Ensure ofagent unit tests handles random hashseeds X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ab0992cf5303752f054ad4d47f0a949aadbea83a;p=openstack-build%2Fneutron-build.git Ensure ofagent unit tests handles random hashseeds Several tests in test_ofa_neutron_agent.py and test_ofa_flows.py fail when running the unit tests with hashseed 2701526934. This patch fixes the failing unit tests by specifying that assert_has_calls does not need to assert any order. Change-Id: I48d6601130f7de1f6eeb7333a17eddd82e7acbdf Partial-Bug: 1348818 --- diff --git a/neutron/tests/unit/ofagent/test_ofa_flows.py b/neutron/tests/unit/ofagent/test_ofa_flows.py index af92f9b49..a73328803 100644 --- a/neutron/tests/unit/ofagent/test_ofa_flows.py +++ b/neutron/tests/unit/ofagent/test_ofa_flows.py @@ -84,7 +84,7 @@ class TestOFAgentFlows(ofa_test_base.OFATestBase): priority=0, table_id=12)), call(ofpp.OFPFlowMod(dp, priority=0, table_id=13)), ] - sendmsg.assert_has_calls(expected_calls) + sendmsg.assert_has_calls(expected_calls, any_order=True) def test_install_arp_responder(self): br = self.br diff --git a/neutron/tests/unit/ofagent/test_ofa_neutron_agent.py b/neutron/tests/unit/ofagent/test_ofa_neutron_agent.py index 638b40120..32d2721e8 100644 --- a/neutron/tests/unit/ofagent/test_ofa_neutron_agent.py +++ b/neutron/tests/unit/ofagent/test_ofa_neutron_agent.py @@ -662,7 +662,8 @@ class TestOFANeutronAgent(ofa_test_base.OFAAgentTestBase): mock.call(self.agent.local_vlan_map[self.lvms[0].net].vlan, 'ip2', 'mac2') ] - self.ryuapp.add_arp_table_entry.assert_has_calls(calls) + self.ryuapp.add_arp_table_entry.assert_has_calls(calls, + any_order=True) setup_tun_fn.assert_called_once_with(self.agent.int_br, '192.0.2.1', 'gre') @@ -685,7 +686,8 @@ class TestOFANeutronAgent(ofa_test_base.OFAAgentTestBase): mock.call(self.agent.local_vlan_map[self.lvms[0].net].vlan, 'ip2', 'mac2') ] - self.ryuapp.add_arp_table_entry.assert_has_calls(calls) + self.ryuapp.add_arp_table_entry.assert_has_calls(calls, + any_order=True) self.assertFalse(setup_tun_fn.called) def test_add_arp_table_entry_vlan(self): @@ -716,7 +718,8 @@ class TestOFANeutronAgent(ofa_test_base.OFAAgentTestBase): mock.call(self.agent.local_vlan_map[self.lvms[0].net].vlan, 'ip2') ] - self.ryuapp.del_arp_table_entry.assert_has_calls(calls) + self.ryuapp.del_arp_table_entry.assert_has_calls(calls, + any_order=True) cleanup_tun_fn.assert_called_once_with(self.agent.int_br, 1, 'gre') def _test_del_arp_table_entry_non_tunnel(self, network_type): @@ -738,7 +741,8 @@ class TestOFANeutronAgent(ofa_test_base.OFAAgentTestBase): mock.call(self.agent.local_vlan_map[self.lvms[0].net].vlan, 'ip2') ] - self.ryuapp.del_arp_table_entry.assert_has_calls(calls) + self.ryuapp.del_arp_table_entry.assert_has_calls(calls, + any_order=True) self.assertFalse(cleanup_tun_fn.called) def test_del_arp_table_entry_vlan(self):