From: Vincent Bernat Date: Sun, 12 Jan 2020 20:23:43 +0000 (+0100) Subject: tests: skip tests requiring kernel features not present X-Git-Tag: 1.0.5~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cbafbacca083ae6d0415219efd4c3951accc2409;p=thirdparty%2Flldpd.git tests: skip tests requiring kernel features not present Notably, "team" is not available in GCP kernels... --- 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