Skip to content

Commit 9c87472

Browse files
committed
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 <[email protected]>
1 parent 1ad468b commit 9c87472

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tests/packages/mlx/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@ def host_without_mlx_compat_loaded(host_with_saved_yum_state):
2323
if mlx_compat_loaded:
2424
logging.info("test is done so reload mlx_compat")
2525
host.ssh(['modprobe', '-v', 'mlx_compat'])
26+
27+
@pytest.fixture(scope="package")
28+
def host_without_mlx_card(host):
29+
if host.ssh_with_result(["lspci", "|", "grep", "Mellanox"]).returncode == 0:
30+
# Skip test to not mess with mellanox card
31+
pytest.skip("This test can't be run on a host with a mellanox card")
32+
yield host

tests/packages/mlx/test_mellanox-modules-compat.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import pytest
2+
13
# Requirements:
24
# From --hosts parameter:
35
# - 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):
810
host.ssh(['modprobe', '-v', MLX4_MODULE])
911
host.ssh(['modprobe', '-r', '-v', MLX4_MODULE])
1012

13+
@pytest.mark.usefixtures("host_without_mlx_card")
1114
def test_install_mlx_modules_alt(host_without_mlx_compat_loaded):
1215
host = host_without_mlx_compat_loaded
1316

0 commit comments

Comments
 (0)