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
This commit is contained in:
Bradley Jones 2014-10-20 12:34:55 +01:00
parent a10e2aa734
commit ab0992cf53
2 changed files with 9 additions and 5 deletions

View File

@ -84,7 +84,7 @@ class TestOFAgentFlows(ofa_test_base.OFATestBase):
priority=0, table_id=12)), priority=0, table_id=12)),
call(ofpp.OFPFlowMod(dp, priority=0, table_id=13)), 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): def test_install_arp_responder(self):
br = self.br br = self.br

View File

@ -662,7 +662,8 @@ class TestOFANeutronAgent(ofa_test_base.OFAAgentTestBase):
mock.call(self.agent.local_vlan_map[self.lvms[0].net].vlan, mock.call(self.agent.local_vlan_map[self.lvms[0].net].vlan,
'ip2', 'mac2') '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, setup_tun_fn.assert_called_once_with(self.agent.int_br,
'192.0.2.1', 'gre') '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, mock.call(self.agent.local_vlan_map[self.lvms[0].net].vlan,
'ip2', 'mac2') '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) self.assertFalse(setup_tun_fn.called)
def test_add_arp_table_entry_vlan(self): 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, mock.call(self.agent.local_vlan_map[self.lvms[0].net].vlan,
'ip2') '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') cleanup_tun_fn.assert_called_once_with(self.agent.int_br, 1, 'gre')
def _test_del_arp_table_entry_non_tunnel(self, network_type): 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, mock.call(self.agent.local_vlan_map[self.lvms[0].net].vlan,
'ip2') '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) self.assertFalse(cleanup_tun_fn.called)
def test_del_arp_table_entry_vlan(self): def test_del_arp_table_entry_vlan(self):