]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
test_ovs_neutron_agent: Fix test_cleanup_stale_flows_iter_0
authorYAMAMOTO Takashi <yamamoto@midokura.com>
Mon, 24 Aug 2015 08:41:08 +0000 (17:41 +0900)
committerYAMAMOTO Takashi <yamamoto@midokura.com>
Mon, 24 Aug 2015 08:41:32 +0000 (17:41 +0900)
- Mock the correct variable
- Ensure that non-stale flows are not removed

Change-Id: I68b360d4d3cdaaa9077244a5783418456af5c48c

neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py

index f4b422879a9cff15a184168aabf0b3cf01901e2d..eb16bff2605a9c152619ec0bae6ebc305cbcac04 100644 (file)
@@ -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