From 723df147b91f6397666b6193063c70297a331ce6 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Fri, 7 Apr 2017 13:07:33 -0700 Subject: [PATCH] Ignore gre devices when fetching devices in test_cleanup_stale_devices They may show up in namespaces depending on kernel modules loaded. Change-Id: I78892244d17c4ab7421d3eae9bdeeec1e69690bc Related-Bug: #1604115 (cherry picked from commit 5c286f590f390a25399093afc61cbf4db396fe1c) --- neutron/tests/functional/agent/linux/test_dhcp.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/neutron/tests/functional/agent/linux/test_dhcp.py b/neutron/tests/functional/agent/linux/test_dhcp.py index 459e387edb5..04dc4fce28b 100644 --- a/neutron/tests/functional/agent/linux/test_dhcp.py +++ b/neutron/tests/functional/agent/linux/test_dhcp.py @@ -12,6 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. +import functools + import mock from oslo_config import cfg @@ -75,15 +77,18 @@ class TestDhcp(functional_base.BaseSudoTestCase): "10:22:33:44:55:69", namespace="qdhcp-foo_id") ipw = ip_lib.IPWrapper(namespace="qdhcp-foo_id") - devices = ipw.get_devices(exclude_loopback=True) + get_devices = functools.partial( + ipw.get_devices, + exclude_loopback=True, exclude_gre_devices=True) + devices = get_devices() self.addCleanup(ipw.netns.delete, 'qdhcp-foo_id') self.assertEqual(2, len(devices)) # setting up dhcp for the network dev_mgr.setup(tests_base.AttributeDict(network)) common_utils.wait_until_true( - lambda: 1 == len(ipw.get_devices(exclude_loopback=True)), + lambda: 1 == len(get_devices()), timeout=5, sleep=0.1, exception=RuntimeError("only one non-loopback device must remain")) - devices = ipw.get_devices(exclude_loopback=True) + devices = get_devices() self.assertEqual("tapfoo_port_id", devices[0].name)