Skip to content

Commit

Permalink
pytest-infra: fix failures
Browse files Browse the repository at this point in the history
pytest-infra 10.0.0 release changed the get_variables() behavior which led to CI failures
(pytest-dev/pytest-testinfra#724)
Starting of now all groups the host is part of and not only the direct parent groups are
returned by get_variables()

Signed-off-by: Teoman ONAY <[email protected]>
(cherry picked from commit 37a8222)
  • Loading branch information
asm0deuz authored and guits committed Mar 10, 2024
1 parent a0c637b commit f34484f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ def node(host, request):
'dev': 99
}

sanitized_group_names = group_names
if 'all' in sanitized_group_names:
sanitized_group_names.remove('all')

# capture the initial/default state
test_is_applicable = False
for marker in request.node.iter_markers():
Expand All @@ -133,7 +137,7 @@ def node(host, request):
if request.node.get_closest_marker('rbdmirror_secondary') and not ceph_rbd_mirror_remote_user: # noqa E501
pytest.skip('Not a valid test for a non-secondary rbd-mirror node')

if request.node.get_closest_marker('ceph_crash') and group_names in [['nfss'], ['iscsigws'], ['clients'], ['monitoring']]:
if request.node.get_closest_marker('ceph_crash') and sanitized_group_names in [['nfss'], ['iscsigws'], ['clients'], ['monitoring']]:
pytest.skip('Not a valid test for nfs, client or iscsigw nodes')

if request.node.get_closest_marker("no_docker") and docker:
Expand All @@ -148,7 +152,7 @@ def node(host, request):
pytest.skip(
"Not a valid test with dashboard disabled")

if request.node.get_closest_marker("dashboard") and group_names == ['clients']:
if request.node.get_closest_marker("dashboard") and sanitized_group_names == ['clients']:
pytest.skip('Not a valid test for client node')

data = dict(
Expand Down

0 comments on commit f34484f

Please sign in to comment.