From 053bbfb847aa25b0bcded1d2525e61ded3247f26 Mon Sep 17 00:00:00 2001 From: suchita-g Date: Thu, 9 Nov 2023 15:29:56 +0530 Subject: [PATCH 1/9] Adding Markers for FUSION HCI Provider Client Platform Signed-off-by: suchita-g --- ocs_ci/framework/__init__.py | 24 ++++- .../framework/pytest_customization/marks.py | 47 +++++++++ ocs_ci/ocs/cluster.py | 28 ++++++ ocs_ci/ocs/constants.py | 5 + .../test_hci_pc_markers.py | 96 +++++++++++++++++++ 5 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 tests/hci_provider_client/test_hci_pc_markers.py diff --git a/ocs_ci/framework/__init__.py b/ocs_ci/framework/__init__.py index f6f9430496f..87b03dfac54 100644 --- a/ocs_ci/framework/__init__.py +++ b/ocs_ci/framework/__init__.py @@ -355,7 +355,7 @@ def current_cluster_name(self): def is_provider_exist(self): """ - Check if the provider cluster exists in the clusters + Check ifq the provider cluster exists in the clusters Returns: bool: True, if the provider cluster exists in the clusters. False, otherwise. @@ -375,6 +375,28 @@ def is_consumer_exist(self): cluster_types = [cluster.ENV_DATA["cluster_type"] for cluster in self.clusters] return "consumer" in cluster_types + def is_hci_client_exist(self): + """ + Check if the hci_client cluster exists in the clusters + + Returns: + bool: True, if the hci_client cluster exists in the clusters. False, otherwise. + + """ + cluster_types = [cluster.ENV_DATA["cluster_type"] for cluster in self.clusters] + return "hci_client" in cluster_types + + def is_hci_provider_exist(self): + """ + Check if the provider cluster exists in the clusters + + Returns: + bool: True, if the provider cluster exists in the clusters. False, otherwise. + + """ + cluster_types = [cluster.ENV_DATA["cluster_type"] for cluster in self.clusters] + return "provider" in cluster_types + def is_cluster_type_exist(self, cluster_type): """ Check if the given cluster type exists in the clusters diff --git a/ocs_ci/framework/pytest_customization/marks.py b/ocs_ci/framework/pytest_customization/marks.py index 215738adc17..0587f2720bd 100644 --- a/ocs_ci/framework/pytest_customization/marks.py +++ b/ocs_ci/framework/pytest_customization/marks.py @@ -25,6 +25,7 @@ OPENSHIFT_DEDICATED_PLATFORM, MANAGED_SERVICE_PLATFORMS, HPCS_KMS_PROVIDER, + HCI_PROVIDER_CLIENT_PLATFORMS, ) from ocs_ci.utility import version from ocs_ci.utility.aws import update_config_from_s3 @@ -274,6 +275,31 @@ reason="Test runs ONLY on Managed service with provider and consumer clusters", ) +hci_client_required = pytest.mark.skipif( + not ( + config.default_cluster_ctx.ENV_DATA["platform"].lower() + in HCI_PROVIDER_CLIENT_PLATFORMS + and config.default_cluster_ctx.ENV_DATA["cluster_type"].lower() == "hci_client" + ), + reason="Test runs ONLY on Fusion HCI Client cluster", +) + +hci_provider_required = pytest.mark.skipif( + not ( + config.default_cluster_ctx.ENV_DATA["platform"].lower() + in HCI_PROVIDER_CLIENT_PLATFORMS + and config.default_cluster_ctx.ENV_DATA["cluster_type"].lower() == "provider" + ), + reason="Test runs ONLY on Fusion HCI Provider cluster", +) +hci_provider_and_client_required = pytest.mark.skipif( + not ( + config.ENV_DATA["platform"].lower() in HCI_PROVIDER_CLIENT_PLATFORMS + and config.is_hci_provider_exist() + and config.is_hci_client_exist() + ), + reason="Test runs ONLY on Fusion HCI provider and client clusters", +) kms_config_required = pytest.mark.skipif( ( config.ENV_DATA["KMS_PROVIDER"].lower() != HPCS_KMS_PROVIDER @@ -342,6 +368,27 @@ reason="Test will not run on Managed service with provider and consumer clusters", ) +skipif_hci_provider = pytest.mark.skipif( + config.default_cluster_ctx.ENV_DATA["platform"].lower() + in HCI_PROVIDER_CLIENT_PLATFORMS + and config.default_cluster_ctx.ENV_DATA["cluster_type"].lower() == "provider", + reason="Test will not run on Fusion HCI provider cluster", +) + +skipif_hci_client = pytest.mark.skipif( + config.default_cluster_ctx.ENV_DATA["platform"].lower() + in HCI_PROVIDER_CLIENT_PLATFORMS + and config.default_cluster_ctx.ENV_DATA["cluster_type"].lower() == "hci_client", + reason="Test will not run on Fusion HCI client cluster", +) + +skipif_hci_provider_and_client = pytest.mark.skipif( + config.ENV_DATA["platform"].lower() in HCI_PROVIDER_CLIENT_PLATFORMS + and config.is_hci_provider_exist() + and config.is_hci_client_exist(), + reason="Test will not run on Fusion HCI provider and Client clusters", +) + skipif_rosa = pytest.mark.skipif( config.ENV_DATA["platform"].lower() == ROSA_PLATFORM, reason="Test will not run on ROSA cluster", diff --git a/ocs_ci/ocs/cluster.py b/ocs_ci/ocs/cluster.py index f5978df6633..301c2d657cf 100644 --- a/ocs_ci/ocs/cluster.py +++ b/ocs_ci/ocs/cluster.py @@ -2202,6 +2202,20 @@ def is_ms_consumer_cluster(): ) +def is_hci_client_cluster(): + """ + Check if the cluster is a Fusion HCI Client cluster + + Returns: + bool: True, if the cluster is a Fusion HCI client cluster. False, otherwise + + """ + return ( + config.ENV_DATA["platform"].lower() in constants.HCI_PROVIDER_CLIENT_PLATFORMS + and config.ENV_DATA["cluster_type"].lower() == "hci_client" + ) + + def is_ms_provider_cluster(): """ Check if the cluster is a managed service provider cluster @@ -2216,6 +2230,20 @@ def is_ms_provider_cluster(): ) +def is_hci_provider_cluster(): + """ + Check if the cluster is a Fusion HCI provider cluster + + Returns: + bool: True, if the cluster is a Fusion HCI provider cluster. False, otherwise + + """ + return ( + config.ENV_DATA["platform"].lower() in constants.HCI_PROVIDER_CLIENT_PLATFORMS + and config.ENV_DATA["cluster_type"].lower() == "provider" + ) + + def get_osd_dump(pool_name): """ Get the osd dump part of a given pool diff --git a/ocs_ci/ocs/constants.py b/ocs_ci/ocs/constants.py index ce61a2b851b..a865a48147e 100644 --- a/ocs_ci/ocs/constants.py +++ b/ocs_ci/ocs/constants.py @@ -1010,6 +1010,11 @@ FUSIONAAS_PLATFORM, ] BAREMETAL_PLATFORMS = [BAREMETAL_PLATFORM, BAREMETALPSI_PLATFORM] +HCI_PROVIDER_CLIENT_PLATFORMS = [ + BAREMETAL_PLATFORM, + VSPHERE_PLATFORM, + IBMCLOUD_PLATFORM, +] # AWS i3 worker instance for LSO AWS_LSO_WORKER_INSTANCE = "i3en.2xlarge" diff --git a/tests/hci_provider_client/test_hci_pc_markers.py b/tests/hci_provider_client/test_hci_pc_markers.py new file mode 100644 index 00000000000..36dc66340ab --- /dev/null +++ b/tests/hci_provider_client/test_hci_pc_markers.py @@ -0,0 +1,96 @@ +import logging +import pytest + +from ocs_ci.framework.pytest_customization.marks import yellow_squad +from ocs_ci.framework.testlib import ( + libtest, + ManageTest, + ignore_leftovers, + hci_provider_and_client_required, + skipif_hci_client, + skipif_hci_provider, + runs_on_provider, +) +from ocs_ci.ocs.cluster import ( + is_hci_client_cluster, + is_hci_provider_cluster, +) +from ocs_ci.ocs.managedservice import check_and_change_current_index_to_default_index + +logger = logging.getLogger(__name__) + + +@yellow_squad +@libtest +@hci_provider_and_client_required +@ignore_leftovers +class TestHCIProviderClientMarkers(ManageTest): + """ + Test that the HCI Provider Client markers work as expected + """ + + @pytest.mark.first + def test_default_cluster_context_index_equal_to_current_index(self): + """ + Test that the default cluster index is equal to the current cluster index. This test should run first + """ + assert ( + check_and_change_current_index_to_default_index() + ), "The default cluster index is different from the current cluster index" + logger.info( + "The default cluster index is equal to the current cluster index as expected" + ) + + @skipif_hci_client + def test_marker_skipif_hci_client(self): + """ + Test that the 'skipif_hci_client' marker work as expected + """ + assert ( + not is_hci_client_cluster() + ), "The cluster is a HCI Client cluster, even though we have the marker 'skipif_hci_client'" + logger.info("The cluster is not a HCI Client cluster as expected") + + assert check_and_change_current_index_to_default_index() + logger.info( + "The default cluster index is equal to the current cluster index as expected" + ) + + @skipif_hci_provider + def test_marker_skipif_hci_provider(self): + """ + Test that the 'skipif_hci_provider' marker work as expected + """ + assert ( + not is_hci_provider_cluster() + ), "The cluster is a HCI provider cluster, even though we have the marker 'skipif_hci_provider'" + logger.info("The cluster is not a HCI provider cluster as expected") + + assert check_and_change_current_index_to_default_index() + logger.info( + "The default cluster index is equal to the current cluster index as expected" + ) + + @runs_on_provider + @pytest.mark.second_to_last + def test_runs_on_provider_marker(self): + """ + Test that the 'runs_on_provider' marker work as expected + """ + assert ( + is_hci_provider_cluster() + ), "The cluster is not a HCI provider cluster, even though we have the marker 'runs_on_provider'" + logger.info("The cluster is a provider cluster as expected") + + @pytest.mark.last + def test_current_index_not_change_after_using_runs_on_provider(self): + """ + Test that the current cluster index didn't change after using the 'runs_on_provider' + marker in the previous test. + """ + assert ( + check_and_change_current_index_to_default_index() + ), "The current cluster index has changed after using the 'runs_on_provider' marker" + logger.info( + "The current cluster index didn't change after using the 'runs_on_provider' marker" + ) From b3f318e4b673fd3cda115407db969273fd068cd5 Mon Sep 17 00:00:00 2001 From: suchita-g Date: Thu, 9 Nov 2023 21:10:08 +0530 Subject: [PATCH 2/9] Redefining the fixure switch_to_provider_for_test to include HCI Provider Signed-off-by: suchita-g --- ocs_ci/framework/__init__.py | 2 +- tests/conftest.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ocs_ci/framework/__init__.py b/ocs_ci/framework/__init__.py index 87b03dfac54..d2b66a211fa 100644 --- a/ocs_ci/framework/__init__.py +++ b/ocs_ci/framework/__init__.py @@ -355,7 +355,7 @@ def current_cluster_name(self): def is_provider_exist(self): """ - Check ifq the provider cluster exists in the clusters + Check if the provider cluster exists in the clusters Returns: bool: True, if the provider cluster exists in the clusters. False, otherwise. diff --git a/tests/conftest.py b/tests/conftest.py index 80bacae61dd..99e0ff494a9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5938,7 +5938,7 @@ def toolbox_on_faas_consumer(): @pytest.fixture(scope="function", autouse=True) def switch_to_provider_for_test(request): """ - Switch to provider cluster as required by the test. Applicable for Managed Services only if + Switch to provider cluster as required by the test. Applicable for Managed Services and HCI Provider-client only if the marker 'runs_on_provider' is added in the test. """ @@ -5947,11 +5947,18 @@ def switch_to_provider_for_test(request): if ( request.node.get_closest_marker("runs_on_provider") and ocsci_config.multicluster - and current_cluster.ENV_DATA.get("platform", "").lower() - in constants.MANAGED_SERVICE_PLATFORMS + and ( + current_cluster.ENV_DATA.get("platform", "").lower() + in constants.MANAGED_SERVICE_PLATFORMS + or current_cluster.ENV_DATA.get("platform", "").lower() + in constants.HCI_PROVIDER_CLIENT_PLATFORMS + ) ): for cluster in ocsci_config.clusters: - if cluster.ENV_DATA.get("cluster_type") == "provider": + if ( + cluster.ENV_DATA.get("cluster_type") == "provider" + or cluster.ENV_DATA.get("cluster_type") == "hci_provider" + ): provider_cluster = cluster log.debug("Switching to the provider cluster context") # TODO: Use 'switch_to_provider' function introduced in PR 5541 From ea372a6450309ce29042534e02b1b9714415f3fa Mon Sep 17 00:00:00 2001 From: suchita-g Date: Thu, 9 Nov 2023 21:56:59 +0530 Subject: [PATCH 3/9] Change w.r.t. change in cluster type as provider instead of hci_provider Signed-off-by: suchita-g --- tests/conftest.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 99e0ff494a9..cc24b3be389 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5955,10 +5955,7 @@ def switch_to_provider_for_test(request): ) ): for cluster in ocsci_config.clusters: - if ( - cluster.ENV_DATA.get("cluster_type") == "provider" - or cluster.ENV_DATA.get("cluster_type") == "hci_provider" - ): + if cluster.ENV_DATA.get("cluster_type") == "provider": provider_cluster = cluster log.debug("Switching to the provider cluster context") # TODO: Use 'switch_to_provider' function introduced in PR 5541 From 1221a1357451c1dba987a34bdc76202802a5222b Mon Sep 17 00:00:00 2001 From: suchita-g Date: Tue, 14 Nov 2023 18:21:24 +0530 Subject: [PATCH 4/9] Update the Platfom marker Signed-off-by: suchita-g --- ocs_ci/ocs/constants.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ocs_ci/ocs/constants.py b/ocs_ci/ocs/constants.py index a865a48147e..0ac717589e9 100644 --- a/ocs_ci/ocs/constants.py +++ b/ocs_ci/ocs/constants.py @@ -987,6 +987,8 @@ RHV_PLATFORM = "rhv" ROSA_PLATFORM = "rosa" FUSIONAAS_PLATFORM = "fusion_aas" +HCI_BAREMETAL = "hci_baremetal" +HCI_VSPHERE = "hci_vsphere" ACM_OCP_DEPLOYMENT = "acm_ocp_deployment" ON_PREM_PLATFORMS = [ VSPHERE_PLATFORM, @@ -1010,10 +1012,10 @@ FUSIONAAS_PLATFORM, ] BAREMETAL_PLATFORMS = [BAREMETAL_PLATFORM, BAREMETALPSI_PLATFORM] + HCI_PROVIDER_CLIENT_PLATFORMS = [ - BAREMETAL_PLATFORM, - VSPHERE_PLATFORM, - IBMCLOUD_PLATFORM, + HCI_BAREMETAL, + HCI_VSPHERE, ] # AWS i3 worker instance for LSO From 56e9c8b237007f78e4521e0588aff5929554af28 Mon Sep 17 00:00:00 2001 From: suchita-g Date: Tue, 14 Nov 2023 19:00:57 +0530 Subject: [PATCH 5/9] Fix for issue # 8840 Signed-off-by: suchita-g This will fix blocker issue for provider client run https://github.com/red-hat-storage/ocs-ci/issues/8840 --- tests/conftest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index cc24b3be389..42d1c5d0d61 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -344,7 +344,11 @@ def pytest_collection_modifyitems(session, config, items): log.debug(f"Test: {item} will be skipped due to {skip_condition}") items.remove(item) continue - if skipif_upgraded_from_marker: + if ( + skipif_upgraded_from_marker + and config.ENV_DATA.get("platform", "").lower() + not in constants.HCI_PROVIDER_CLIENT_PLATFORMS + ): skip_args = skipif_upgraded_from_marker.args if skipif_upgraded_from(skip_args[0]): log.debug( From 244fc9ebf6de8242dfc255e7beeda767d485386c Mon Sep 17 00:00:00 2001 From: suchita-g Date: Tue, 14 Nov 2023 19:19:09 +0530 Subject: [PATCH 6/9] Added conditional check for HCI client to redefine operator name Signed-off-by: suchita-g Fixes https://github.com/red-hat-storage/ocs-ci/issues/8841 --- ocs_ci/ocs/defaults.py | 1 + ocs_ci/utility/utils.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ocs_ci/ocs/defaults.py b/ocs_ci/ocs/defaults.py index 91444231f60..701e62a22d2 100644 --- a/ocs_ci/ocs/defaults.py +++ b/ocs_ci/ocs/defaults.py @@ -40,6 +40,7 @@ OCS_OPERATOR_NAME = "ocs-operator" ODF_OPERATOR_NAME = "odf-operator" +HCI_CLIENT_ODF_OPERATOR_NAME = "ocs-client-operator" NOOBAA_OPERATOR = "noobaa-operator" MCG_OPERATOR = "mcg-operator" ODF_CSI_ADDONS_OPERATOR = "odf-csi-addons-operator" diff --git a/ocs_ci/utility/utils.py b/ocs_ci/utility/utils.py index 94b4b97d7dc..0d04a9d2207 100644 --- a/ocs_ci/utility/utils.py +++ b/ocs_ci/utility/utils.py @@ -1810,6 +1810,11 @@ def get_ocs_build_number(): >= version_module.VERSION_4_9 ): operator_name = defaults.ODF_OPERATOR_NAME + if ( + config.ENV_DATA.get("platform") in constants.HCI_PROVIDER_CLIENT_PLATFORMS + and config.ENV_DATA.get("cluster_type") == "hci_client" + ): + operator_name = defaults.HCI_CLIENT_ODF_OPERATOR_NAME else: operator_name = defaults.OCS_OPERATOR_NAME ocs_csvs = get_csvs_start_with_prefix( From 75240378e9b6b1f76ef725e1d743e57a9c697192 Mon Sep 17 00:00:00 2001 From: suchita-g Date: Tue, 14 Nov 2023 20:20:50 +0530 Subject: [PATCH 7/9] Correcting PR Check error Signed-off-by: suchita-g --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 42d1c5d0d61..a05e891ccea 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -346,7 +346,7 @@ def pytest_collection_modifyitems(session, config, items): continue if ( skipif_upgraded_from_marker - and config.ENV_DATA.get("platform", "").lower() + and ocsci_config.ENV_DATA.get("platform", "").lower() not in constants.HCI_PROVIDER_CLIENT_PLATFORMS ): skip_args = skipif_upgraded_from_marker.args From 070cae990884be62d1dec599f36f6164f66132d0 Mon Sep 17 00:00:00 2001 From: suchita-g Date: Tue, 14 Nov 2023 20:46:48 +0530 Subject: [PATCH 8/9] Incorperating Review Comments Signed-off-by: suchita-g --- ocs_ci/framework/__init__.py | 9 +++++---- ocs_ci/framework/pytest_customization/marks.py | 18 ++++++++++-------- ocs_ci/ocs/cluster.py | 4 ++-- ocs_ci/ocs/constants.py | 4 ++++ ocs_ci/utility/utils.py | 2 +- .../test_hci_pc_markers.py | 0 6 files changed, 22 insertions(+), 15 deletions(-) rename tests/{hci_provider_client => libtest}/test_hci_pc_markers.py (100%) diff --git a/ocs_ci/framework/__init__.py b/ocs_ci/framework/__init__.py index d2b66a211fa..3b70fe22557 100644 --- a/ocs_ci/framework/__init__.py +++ b/ocs_ci/framework/__init__.py @@ -13,6 +13,7 @@ import logging from collections.abc import Mapping from dataclasses import dataclass, field, fields +from ocs_ci.ocs.constants import HCI_CLIENT, HCI_PROVIDER from ocs_ci.ocs.exceptions import ClusterNotFoundException THIS_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -375,7 +376,7 @@ def is_consumer_exist(self): cluster_types = [cluster.ENV_DATA["cluster_type"] for cluster in self.clusters] return "consumer" in cluster_types - def is_hci_client_exist(self): + def hci_client_exist(self): """ Check if the hci_client cluster exists in the clusters @@ -384,9 +385,9 @@ def is_hci_client_exist(self): """ cluster_types = [cluster.ENV_DATA["cluster_type"] for cluster in self.clusters] - return "hci_client" in cluster_types + return HCI_CLIENT in cluster_types - def is_hci_provider_exist(self): + def hci_provider_exist(self): """ Check if the provider cluster exists in the clusters @@ -395,7 +396,7 @@ def is_hci_provider_exist(self): """ cluster_types = [cluster.ENV_DATA["cluster_type"] for cluster in self.clusters] - return "provider" in cluster_types + return HCI_PROVIDER in cluster_types def is_cluster_type_exist(self, cluster_type): """ diff --git a/ocs_ci/framework/pytest_customization/marks.py b/ocs_ci/framework/pytest_customization/marks.py index 0587f2720bd..2ef0f41c2ce 100644 --- a/ocs_ci/framework/pytest_customization/marks.py +++ b/ocs_ci/framework/pytest_customization/marks.py @@ -26,6 +26,8 @@ MANAGED_SERVICE_PLATFORMS, HPCS_KMS_PROVIDER, HCI_PROVIDER_CLIENT_PLATFORMS, + HCI_CLIENT, + HCI_PROVIDER, ) from ocs_ci.utility import version from ocs_ci.utility.aws import update_config_from_s3 @@ -279,7 +281,7 @@ not ( config.default_cluster_ctx.ENV_DATA["platform"].lower() in HCI_PROVIDER_CLIENT_PLATFORMS - and config.default_cluster_ctx.ENV_DATA["cluster_type"].lower() == "hci_client" + and config.default_cluster_ctx.ENV_DATA["cluster_type"].lower() == HCI_CLIENT ), reason="Test runs ONLY on Fusion HCI Client cluster", ) @@ -288,15 +290,15 @@ not ( config.default_cluster_ctx.ENV_DATA["platform"].lower() in HCI_PROVIDER_CLIENT_PLATFORMS - and config.default_cluster_ctx.ENV_DATA["cluster_type"].lower() == "provider" + and config.default_cluster_ctx.ENV_DATA["cluster_type"].lower() == HCI_PROVIDER ), reason="Test runs ONLY on Fusion HCI Provider cluster", ) hci_provider_and_client_required = pytest.mark.skipif( not ( config.ENV_DATA["platform"].lower() in HCI_PROVIDER_CLIENT_PLATFORMS - and config.is_hci_provider_exist() - and config.is_hci_client_exist() + and config.hci_provider_exist() + and config.hci_client_exist() ), reason="Test runs ONLY on Fusion HCI provider and client clusters", ) @@ -371,21 +373,21 @@ skipif_hci_provider = pytest.mark.skipif( config.default_cluster_ctx.ENV_DATA["platform"].lower() in HCI_PROVIDER_CLIENT_PLATFORMS - and config.default_cluster_ctx.ENV_DATA["cluster_type"].lower() == "provider", + and config.default_cluster_ctx.ENV_DATA["cluster_type"].lower() == HCI_PROVIDER, reason="Test will not run on Fusion HCI provider cluster", ) skipif_hci_client = pytest.mark.skipif( config.default_cluster_ctx.ENV_DATA["platform"].lower() in HCI_PROVIDER_CLIENT_PLATFORMS - and config.default_cluster_ctx.ENV_DATA["cluster_type"].lower() == "hci_client", + and config.default_cluster_ctx.ENV_DATA["cluster_type"].lower() == HCI_CLIENT, reason="Test will not run on Fusion HCI client cluster", ) skipif_hci_provider_and_client = pytest.mark.skipif( config.ENV_DATA["platform"].lower() in HCI_PROVIDER_CLIENT_PLATFORMS - and config.is_hci_provider_exist() - and config.is_hci_client_exist(), + and config.hci_provider_exist() + and config.hci_client_exist(), reason="Test will not run on Fusion HCI provider and Client clusters", ) diff --git a/ocs_ci/ocs/cluster.py b/ocs_ci/ocs/cluster.py index 301c2d657cf..e02527b62b5 100644 --- a/ocs_ci/ocs/cluster.py +++ b/ocs_ci/ocs/cluster.py @@ -2212,7 +2212,7 @@ def is_hci_client_cluster(): """ return ( config.ENV_DATA["platform"].lower() in constants.HCI_PROVIDER_CLIENT_PLATFORMS - and config.ENV_DATA["cluster_type"].lower() == "hci_client" + and config.ENV_DATA["cluster_type"].lower() == constants.HCI_CLIENT ) @@ -2240,7 +2240,7 @@ def is_hci_provider_cluster(): """ return ( config.ENV_DATA["platform"].lower() in constants.HCI_PROVIDER_CLIENT_PLATFORMS - and config.ENV_DATA["cluster_type"].lower() == "provider" + and config.ENV_DATA["cluster_type"].lower() == constants.HCI_PROVIDER ) diff --git a/ocs_ci/ocs/constants.py b/ocs_ci/ocs/constants.py index 0ac717589e9..3e58000cd69 100644 --- a/ocs_ci/ocs/constants.py +++ b/ocs_ci/ocs/constants.py @@ -237,6 +237,10 @@ MS_PROVIDER_TYPE = "provider" NON_MS_CLUSTER_TYPE = "non_ms" +# HCI cluster types +HCI_CLIENT = "hci_client" +HCI_PROVIDER = "provider" + OCP_QE_MISC_REPO = "https://gitlab.cee.redhat.com/aosqe/flexy-templates.git" CRITICAL_ERRORS = ["core dumped", "oom_reaper"] must_gather_pod_label = "app=must-gather" diff --git a/ocs_ci/utility/utils.py b/ocs_ci/utility/utils.py index 0d04a9d2207..0692c4d0b2c 100644 --- a/ocs_ci/utility/utils.py +++ b/ocs_ci/utility/utils.py @@ -1812,7 +1812,7 @@ def get_ocs_build_number(): operator_name = defaults.ODF_OPERATOR_NAME if ( config.ENV_DATA.get("platform") in constants.HCI_PROVIDER_CLIENT_PLATFORMS - and config.ENV_DATA.get("cluster_type") == "hci_client" + and config.ENV_DATA.get("cluster_type") == constants.HCI_CLIENT ): operator_name = defaults.HCI_CLIENT_ODF_OPERATOR_NAME else: diff --git a/tests/hci_provider_client/test_hci_pc_markers.py b/tests/libtest/test_hci_pc_markers.py similarity index 100% rename from tests/hci_provider_client/test_hci_pc_markers.py rename to tests/libtest/test_hci_pc_markers.py From cdeecd9478ce6551a936beaccc2665dfaf9c6c80 Mon Sep 17 00:00:00 2001 From: suchita-g Date: Wed, 15 Nov 2023 11:02:04 +0530 Subject: [PATCH 9/9] Fixing import error in init.py Signed-off-by: suchita-g --- ocs_ci/framework/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ocs_ci/framework/__init__.py b/ocs_ci/framework/__init__.py index 3b70fe22557..67cd59484a4 100644 --- a/ocs_ci/framework/__init__.py +++ b/ocs_ci/framework/__init__.py @@ -13,7 +13,6 @@ import logging from collections.abc import Mapping from dataclasses import dataclass, field, fields -from ocs_ci.ocs.constants import HCI_CLIENT, HCI_PROVIDER from ocs_ci.ocs.exceptions import ClusterNotFoundException THIS_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -385,7 +384,7 @@ def hci_client_exist(self): """ cluster_types = [cluster.ENV_DATA["cluster_type"] for cluster in self.clusters] - return HCI_CLIENT in cluster_types + return "hci_client" in cluster_types def hci_provider_exist(self): """ @@ -396,7 +395,7 @@ def hci_provider_exist(self): """ cluster_types = [cluster.ENV_DATA["cluster_type"] for cluster in self.clusters] - return HCI_PROVIDER in cluster_types + return "provider" in cluster_types def is_cluster_type_exist(self, cluster_type): """