[lxc-devel] [python3-lxc/master] api_test: fix interfaces comparison failure

vicamo on Github lxc-bot at linuxcontainers.org
Wed Sep 18 09:29:00 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 625 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190918/73a853bd/attachment.bin>
-------------- next part --------------
From 69c41ef51363539226fa362be6f459d39ff1e2cc Mon Sep 17 00:00:00 2001
From: You-Sheng Yang <vicamo at gmail.com>
Date: Wed, 18 Sep 2019 17:23:41 +0800
Subject: [PATCH] api_test: fix interfaces comparison failure

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.

Closes: #2
Signed-off-by: You-Sheng Yang <vicamo at gmail.com>
---
 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 @@
 
 ## 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")


More information about the lxc-devel mailing list