diff --git a/ocs_ci/framework/main.py b/ocs_ci/framework/main.py index 964625ba1004..8b016d6d8ed7 100644 --- a/ocs_ci/framework/main.py +++ b/ocs_ci/framework/main.py @@ -154,6 +154,11 @@ def process_ocsci_conf(arguments): args, unknown = parser.parse_known_args(args=arguments) load_config(args.ocsci_conf) + if unknown: + for each_arg in unknown: + if each_arg.startswith("--cluster-path="): + framework.config.ENV_DATA["cluster_path"] = each_arg.split("=", 1)[1] + break ocs_version = args.ocs_version or framework.config.ENV_DATA.get("ocs_version") ocp_version = args.ocp_version or framework.config.ENV_DATA.get("ocp_version") ocs_registry_image = framework.config.DEPLOYMENT.get("ocs_registry_image") diff --git a/tests/conftest.py b/tests/conftest.py index 73910fa520d4..591f3f7fe38d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1809,6 +1809,20 @@ def environment_checker(request): log.debug("Skipping environment checker") return + node = request.node + # List of marks for which we will ignore the leftover checker + marks_to_ignore = [m.mark for m in [deployment, ignore_leftovers]] + # app labels of resources to be excluded for leftover check + exclude_labels = [ + constants.must_gather_pod_label, + constants.S3CLI_APP_LABEL, + constants.MUST_GATHER_HELPER_LABEL, + ] + for mark in node.iter_markers(): + if mark in marks_to_ignore: + return + if mark.name == ignore_leftover_label.name: + exclude_labels.extend(list(mark.args)) if ocsci_config.ENV_DATA["platform"] in { constants.FUSIONAAS_PLATFORM, constants.HCI_BAREMETAL, @@ -1819,7 +1833,6 @@ def environment_checker(request): "This needs to be updated" ) else: - exclude_labels = get_exclude_labels(request) request.addfinalizer( partial(get_status_after_execution, exclude_labels=exclude_labels) ) @@ -1833,32 +1846,6 @@ def resource_checker(request): return create_resource_dct() - if ocsci_config.ENV_DATA["platform"] in { - constants.FUSIONAAS_PLATFORM, - constants.HCI_BAREMETAL, - constants.HCI_VSPHERE, - }: - log.error( - "Environment checker is NOT IMPLEMENTED for Fusion service and provider/client hci setup." - "This needs to be updated" - ) - else: - exclude_labels = get_exclude_labels(request) - request.addfinalizer( - lambda: get_environment_status_after_execution( - exclude_labels=exclude_labels - ) - ) - - -def get_exclude_labels(request): - """ - Gets the labels which should be excluded for left over checks - - Returns: - list: List of exclude labels - - """ node = request.node # List of marks for which we will ignore the leftover checker marks_to_ignore = [m.mark for m in [deployment, ignore_leftovers]] @@ -1873,8 +1860,21 @@ def get_exclude_labels(request): return if mark.name == ignore_leftover_label.name: exclude_labels.extend(list(mark.args)) - - return exclude_labels + if ocsci_config.ENV_DATA["platform"] in { + constants.FUSIONAAS_PLATFORM, + constants.HCI_BAREMETAL, + constants.HCI_VSPHERE, + }: + log.error( + "Resource checker is NOT IMPLEMENTED for Fusion service and provider/client hci setup." + "This needs to be updated" + ) + else: + request.addfinalizer( + lambda: get_environment_status_after_execution( + exclude_labels=exclude_labels + ) + ) @pytest.fixture(scope="session")