Browse Source

Improve test_set_members_deleting_less_than_5

In test_set_members_deleting_less_than_5[1], 3 ips are deleted from
ipset but test_set_members_deleting_less_than_5 checked that the
first one was deleted because the call ordering was non-trivial.

The test was successful because
assert_has_calls(expected_calls, any_order=False) allows extra calls
before and after expected_calls.

A parent change[2] forces the call ordering, this allows to check that
the 3 ips are deleted.

[1] neutron.tests.unit.agent.linux.test_ipset_manager
[2] I8408365825ec1e97a83c2181f38ec1f9468df91e

Related-Bug: #1348818

Change-Id: I773e2cd19fdec634b728d0c3a78c1d66392c743f
changes/58/185858/3
Cedric Brandily 7 years ago
parent
commit
9ff8cd5246
  1. 2
      neutron/tests/unit/agent/linux/test_ipset_manager.py

2
neutron/tests/unit/agent/linux/test_ipset_manager.py

@ -127,7 +127,7 @@ class IpsetManagerTestCase(BaseIpsetManagerTest):
def test_set_members_deleting_less_than_5(self):
self.add_all_ips()
self.expect_del(FAKE_IPS[3:4])
self.expect_del(FAKE_IPS[3:])
self.ipset.set_members(TEST_SET_ID, ETHERTYPE, FAKE_IPS[0:3])
self.verify_mock_calls()

Loading…
Cancel
Save