Merge "Ignore gre devices when fetching devices in test_cleanup_stale_devices"

This commit is contained in:
Jenkins 2017-04-12 22:21:44 +00:00 committed by Gerrit Code Review
commit 03af8472e6
1 changed files with 8 additions and 3 deletions

View File

@ -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,16 +77,19 @@ 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(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(
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)