Skip to content

Commit

Permalink
Do not run test_mellanox-modules-compat on hosts with Mellanox card
Browse files Browse the repository at this point in the history
The test would break the host when disabling mellanox modules

Signed-off-by: Benjamin Reis <[email protected]>
  • Loading branch information
benjamreis committed Dec 10, 2024
1 parent 1ad468b commit de16691
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/packages/mlx/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions tests/packages/mlx/test_mellanox-modules-compat.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down

0 comments on commit de16691

Please sign in to comment.