From de16691c5b3e7d03dad062f4b3a8f8a60d4bea42 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Tue, 10 Dec 2024 09:58:36 +0100 Subject: [PATCH] Do not run `test_mellanox-modules-compat` on hosts with Mellanox card The test would break the host when disabling mellanox modules Signed-off-by: Benjamin Reis --- tests/packages/mlx/conftest.py | 7 +++++++ tests/packages/mlx/test_mellanox-modules-compat.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/tests/packages/mlx/conftest.py b/tests/packages/mlx/conftest.py index 4bb0f118a..5562a9a8d 100644 --- a/tests/packages/mlx/conftest.py +++ b/tests/packages/mlx/conftest.py @@ -23,3 +23,10 @@ def host_without_mlx_compat_loaded(host_with_saved_yum_state): if mlx_compat_loaded: logging.info("test is done so reload mlx_compat") host.ssh(['modprobe', '-v', 'mlx_compat']) + +@pytest.fixture(scope="package") +def host_without_mlx_card(host): + if host.ssh_with_result(["lspci", "|", "grep", "Mellanox"]).returncode == 0: + # Skip test to not mess with mellanox card + pytest.skip("This test can't be run on a host with a mellanox card") + yield host diff --git a/tests/packages/mlx/test_mellanox-modules-compat.py b/tests/packages/mlx/test_mellanox-modules-compat.py index 2604f0788..e6a67bef7 100644 --- a/tests/packages/mlx/test_mellanox-modules-compat.py +++ b/tests/packages/mlx/test_mellanox-modules-compat.py @@ -1,3 +1,5 @@ +import pytest + # Requirements: # From --hosts parameter: # - host(A1): any master host of a pool, with access to XCP-ng RPM repositories. @@ -8,6 +10,7 @@ def load_unload_mlx_module(host): host.ssh(['modprobe', '-v', MLX4_MODULE]) host.ssh(['modprobe', '-r', '-v', MLX4_MODULE]) +@pytest.mark.usefixtures("host_without_mlx_card") def test_install_mlx_modules_alt(host_without_mlx_compat_loaded): host = host_without_mlx_compat_loaded