diff --git a/conftest.py b/conftest.py index c43516318..fa87c8152 100644 --- a/conftest.py +++ b/conftest.py @@ -19,6 +19,7 @@ Config, CollectReport, ) +from _pytest.nodes import Node from _pytest.terminal import TerminalReporter from typing import Optional, Any from pytest_testconfig import config as py_config @@ -434,9 +435,17 @@ def calculate_must_gather_timer(test_start_time: int) -> int: return default_duration +def get_all_node_markers(node: Node) -> list[str]: + return [mark.name for mark in list(node.iter_markers())] + + +def is_skip_must_gather(node: Node) -> bool: + return "skip_must_gather" in get_all_node_markers(node=node) + + def pytest_exception_interact(node: Item | Collector, call: CallInfo[Any], report: TestReport | CollectReport) -> None: LOGGER.error(report.longreprtext) - if node.config.getoption("--collect-must-gather"): + if node.config.getoption("--collect-must-gather") and not is_skip_must_gather(node=node): test_name = f"{node.fspath}::{node.name}" LOGGER.info(f"Must-gather collection is enabled for {test_name}.") diff --git a/pytest.ini b/pytest.ini index 85ed14ab2..a32d36b64 100644 --- a/pytest.ini +++ b/pytest.ini @@ -20,6 +20,7 @@ markers = ocp_interop: Interop testing with Openshift. downstream_only: Tests that are specific to downstream cluster_health: Tests that verifies that cluster is healthy to begin testing + skip_must_gather: Tests that does not require must-gather for triaging # Model server modelmesh: Mark tests which are model mesh tests diff --git a/tests/model_registry/image_validation/test_verify_rhoai_images.py b/tests/model_registry/image_validation/test_verify_rhoai_images.py index 320afc841..2810f903f 100644 --- a/tests/model_registry/image_validation/test_verify_rhoai_images.py +++ b/tests/model_registry/image_validation/test_verify_rhoai_images.py @@ -29,6 +29,7 @@ class TestModelRegistryImages: """ @pytest.mark.smoke + @pytest.mark.skip_must_gather def test_verify_model_registry_images( self: Self, admin_client: DynamicClient, diff --git a/tests/model_registry/model_catalog/test_default_model_catalog.py b/tests/model_registry/model_catalog/test_default_model_catalog.py index 22435e4cd..58e0944d6 100644 --- a/tests/model_registry/model_catalog/test_default_model_catalog.py +++ b/tests/model_registry/model_catalog/test_default_model_catalog.py @@ -30,6 +30,7 @@ ] +@pytest.mark.skip_must_gather class TestModelCatalogGeneral: @pytest.mark.post_upgrade def test_config_map_exists(self: Self, catalog_config_map: ConfigMap):