From 63ff8f7fbe1d7170c052f6a1df7304bdbecfe198 Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Tue, 4 Apr 2017 03:52:37 -0700 Subject: [PATCH] Assert contents of returned devices in test Having this test fail with: testtools.matchers._impl.MismatchError: 2 != 4 Doesn't really tell the developer what went wrong. We can just compare the lists of devices directly so a mismatch will show the devices that leaked in. TrivialFix Change-Id: Ic5a3b347bea7e5aa8a5caee5035568e5954f58dc --- neutron/tests/functional/agent/linux/test_dhcp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neutron/tests/functional/agent/linux/test_dhcp.py b/neutron/tests/functional/agent/linux/test_dhcp.py index 009f335fb9b..8d5ca163113 100644 --- a/neutron/tests/functional/agent/linux/test_dhcp.py +++ b/neutron/tests/functional/agent/linux/test_dhcp.py @@ -77,7 +77,8 @@ class TestDhcp(functional_base.BaseSudoTestCase): ipw = ip_lib.IPWrapper(namespace="qdhcp-foo_id") devices = ipw.get_devices(exclude_loopback=True) self.addCleanup(ipw.netns.delete, 'qdhcp-foo_id') - self.assertEqual(2, len(devices)) + self.assertEqual(sorted(["tapfoo_id2", "tapfoo_id3"]), + sorted(map(str, devices))) # setting up dhcp for the network dev_mgr.setup(tests_base.AttributeDict(network)) common_utils.wait_until_true(