From: YAMAMOTO Takashi Date: Mon, 24 Aug 2015 08:41:08 +0000 (+0900) Subject: test_ovs_neutron_agent: Fix test_cleanup_stale_flows_iter_0 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=4d5146833b4d79502c6745919113fb13658d2a82;p=openstack-build%2Fneutron-build.git test_ovs_neutron_agent: Fix test_cleanup_stale_flows_iter_0 - Mock the correct variable - Ensure that non-stale flows are not removed Change-Id: I68b360d4d3cdaaa9077244a5783418456af5c48c --- diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py index f4b422879..eb16bff26 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py @@ -1259,7 +1259,8 @@ class TestOvsNeutronAgent(object): self.assertEqual(10, rpc_client.timeout) def test_cleanup_stale_flows_iter_0(self): - with mock.patch.object(self.agent, 'agent_uuid_stamp', new=1234),\ + with mock.patch.object(self.agent.int_br, 'agent_uuid_stamp', + new=1234),\ mock.patch.object(self.agent.int_br, 'dump_flows_all_tables') as dump_flows,\ mock.patch.object(self.agent.int_br, @@ -1271,10 +1272,11 @@ class TestOvsNeutronAgent(object): 'cookie=0x4d2, duration=52.112s, table=3, actions=drop', ] self.agent.cleanup_stale_flows() - del_flow.assert_has_calls([mock.call(cookie='0x4321/-1', - table='2'), - mock.call(cookie='0x2345/-1', - table='2')]) + expected = [ + mock.call(cookie='0x4321/-1', table='2'), + mock.call(cookie='0x2345/-1', table='2'), + ] + self.assertEqual(expected, del_flow.mock_calls) def test_set_rpc_timeout_no_value(self): self.agent.quitting_rpc_timeout = None