From 69c41ef51363539226fa362be6f459d39ff1e2cc Mon Sep 17 00:00:00 2001 From: You-Sheng Yang Date: Wed, 18 Sep 2019 17:23:41 +0800 Subject: [PATCH] api_test: fix interfaces comparison failure BugLink: https://bugs.launchpad.net/bugs/1764618 When the host has kernel module sit or ipip inserted, additional network interfaces sit0 and/or tunl0 would appear inside the container by default as well, which fails the api_test. This change append sit0/tunl0 to expected interfaces when applicable. Signed-off-by: You-Sheng Yang --- examples/api_test.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/api_test.py b/examples/api_test.py index 1934a23..4aeff01 100755 --- a/examples/api_test.py +++ b/examples/api_test.py @@ -106,7 +106,12 @@ assert(container.state == "RUNNING") ## Checking IP address print("Getting the interface names") -assert(set(container.get_interfaces()) == set(('lo', 'eth0'))) +expected_ifs = set(('lo', 'eth0')) +if os.path.isdir('/sys/module/sit'): + expected_ifs.add('sit0') +if os.path.isdir('/sys/module/ipip'): + expected_ifs.add('tunl0') +assert(set(container.get_interfaces()) == expected_ifs) ## Checking IP address print("Getting the IP addresses") -- 2.23.0