From cbafbacca083ae6d0415219efd4c3951accc2409 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 12 Jan 2020 21:23:43 +0100 Subject: [PATCH] tests: skip tests requiring kernel features not present Notably, "team" is not available in GCP kernels... --- tests/integration/fixtures/programs.py | 15 +++++++++++++++ tests/integration/test_interfaces.py | 2 ++ 2 files changed, 17 insertions(+) diff --git a/tests/integration/fixtures/programs.py b/tests/integration/fixtures/programs.py index a5de4836..08e860b9 100644 --- a/tests/integration/fixtures/programs.py +++ b/tests/integration/fixtures/programs.py @@ -449,6 +449,19 @@ def pytest_configure(config): re.search(r"^lldpd (.*)$", output, re.MULTILINE).group(1)) + # Also retrieve some kernel capabilities + features = [] + for feature in ["rtnl-link-team"]: + ret = subprocess.call(["/sbin/modprobe", "--quiet", "--dry-run", + feature]) + if ret == 0: + features.append(feature) + config.kernel = namedtuple('kernel', + ['features', + 'version'])( + features, + os.uname().release) + def pytest_report_header(config): """Report lldpd/lldpcli version and configuration.""" @@ -457,6 +470,8 @@ def pytest_report_header(config): config.lldpd.features))) print('lldpcli: {} {}'.format(config.lldpcli.version, ", ".join(config.lldpcli.outputs))) + print('kernel: {} {}'.format(config.kernel.version, + ", ".join(config.kernel.features))) print('{}: {} {} {}'.format(platform.system().lower(), platform.release(), platform.version(), diff --git a/tests/integration/test_interfaces.py b/tests/integration/test_interfaces.py index 5247fd11..db73c391 100644 --- a/tests/integration/test_interfaces.py +++ b/tests/integration/test_interfaces.py @@ -117,6 +117,8 @@ def test_bond(lldpd1, lldpd, lldpcli, namespaces, links, when): @pytest.mark.skipif("'Dot3' not in config.lldpd.features", reason="Dot3 not supported") +@pytest.mark.skipif("'rtnl-link-team' not in config.kernel.features", + reason="No team support in kernel") @pytest.mark.parametrize('when', ['before', 'after']) def test_team(lldpd1, lldpd, lldpcli, namespaces, links, when): links(namespaces(3), namespaces(2)) # Another link to setup a bond -- 2.39.5