tests: do not run qemu interface tests if the environment does not allow it

cdf73b9731 has added the qemu tests as part of the default test run,
which results in "make test" failure in more restricted environments which do not allow the
namespace creation.

Add a config flag to skip those tests, and skip them if the namespace creation fails.

Type: test
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: Ie631f7fb2a80864f77c79619eba4a43712e950e5
This commit is contained in:
Andrew Yourtchenko
2023-06-20 14:52:08 +00:00
parent 4aeba37762
commit 9ba6dcf558
3 changed files with 39 additions and 2 deletions

View File

@ -63,6 +63,9 @@ layer3 = test_config["L3"]
def create_test(test_name, test, ip_version, mtu):
"""Create and return a unittest method for a test."""
@unittest.skipIf(
config.skip_netns_tests, "netns not available or disabled from cli"
)
def test_func(self):
self.logger.debug(f"Starting unittest:{test_name}")
self.setUpTestToplogy(test=test, ip_version=ip_version)
@ -97,6 +100,8 @@ def create_test(test_name, test, ip_version, mtu):
def generate_vpp_interface_tests():
"""Generate unittests for testing vpp interfaces."""
if config.skip_netns_tests:
print("Skipping netns tests")
for test in tests:
for ip_version in test_config["ip_versions"]:
for mtu in test_config["mtus"]: