Skip to content

Commit bfdee7e

Browse files
rhods-ci-botdbasunagjgarciao
authored
allow skipping must-gather collection for tests (#644) (#661)
Co-authored-by: Debarati Basu-Nag <[email protected]> Co-authored-by: Jorge <[email protected]>
1 parent 9f9ec9a commit bfdee7e

4 files changed

Lines changed: 13 additions & 1 deletion

File tree

conftest.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
Config,
2020
CollectReport,
2121
)
22+
from _pytest.nodes import Node
2223
from _pytest.terminal import TerminalReporter
2324
from typing import Optional, Any
2425
from pytest_testconfig import config as py_config
@@ -434,9 +435,17 @@ def calculate_must_gather_timer(test_start_time: int) -> int:
434435
return default_duration
435436

436437

438+
def get_all_node_markers(node: Node) -> list[str]:
439+
return [mark.name for mark in list(node.iter_markers())]
440+
441+
442+
def is_skip_must_gather(node: Node) -> bool:
443+
return "skip_must_gather" in get_all_node_markers(node=node)
444+
445+
437446
def pytest_exception_interact(node: Item | Collector, call: CallInfo[Any], report: TestReport | CollectReport) -> None:
438447
LOGGER.error(report.longreprtext)
439-
if node.config.getoption("--collect-must-gather"):
448+
if node.config.getoption("--collect-must-gather") and not is_skip_must_gather(node=node):
440449
test_name = f"{node.fspath}::{node.name}"
441450
LOGGER.info(f"Must-gather collection is enabled for {test_name}.")
442451

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ markers =
2020
ocp_interop: Interop testing with Openshift.
2121
downstream_only: Tests that are specific to downstream
2222
cluster_health: Tests that verifies that cluster is healthy to begin testing
23+
skip_must_gather: Tests that does not require must-gather for triaging
2324

2425
# Model server
2526
modelmesh: Mark tests which are model mesh tests

tests/model_registry/image_validation/test_verify_rhoai_images.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class TestModelRegistryImages:
2929
"""
3030

3131
@pytest.mark.smoke
32+
@pytest.mark.skip_must_gather
3233
def test_verify_model_registry_images(
3334
self: Self,
3435
admin_client: DynamicClient,

tests/model_registry/model_catalog/test_default_model_catalog.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
]
3131

3232

33+
@pytest.mark.skip_must_gather
3334
class TestModelCatalogGeneral:
3435
@pytest.mark.post_upgrade
3536
def test_config_map_exists(self: Self, catalog_config_map: ConfigMap):

0 commit comments

Comments
 (0)