]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
pytest-infra: fix failures
authorTeoman ONAY <tonay@ibm.com>
Mon, 15 Jan 2024 21:27:17 +0000 (22:27 +0100)
committerGuillaume Abrioux <gabrioux@ibm.com>
Wed, 14 Feb 2024 08:54:13 +0000 (09:54 +0100)
pytest-infra 10.0.0 release changed the get_variables() behavior which led to CI failures
(https://github.com/pytest-dev/pytest-testinfra/pull/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 <tonay@ibm.com>
tests/conftest.py

index 89194b02269689e4b7e118302d9c1403a27d549d..3831b4563d00df847cbf4ce5c3c881a4a470e735 100644 (file)
@@ -147,6 +147,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():
@@ -163,7 +167,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:
@@ -178,7 +182,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(