From e17d1e9b3e944eebf9a75aa099901d93b8e7c8a3 Mon Sep 17 00:00:00 2001 From: Daniel Osypenko Date: Thu, 5 Dec 2024 11:05:35 +0200 Subject: [PATCH] fetch storage ns from config (#10951) * fetch storage ns from config Signed-off-by: Daniel Osypenko --- ocs_ci/deployment/hosted_cluster.py | 8 ++++---- .../provider_client/storage_client_deployment.py | 2 +- ocs_ci/helpers/helpers.py | 2 +- ocs_ci/ocs/bucket_utils.py | 2 +- ocs_ci/ocs/replica_one.py | 7 ++++--- ocs_ci/ocs/resources/pod.py | 8 ++++---- ocs_ci/ocs/resources/stretchcluster.py | 3 ++- ocs_ci/ocs/ui/validation_ui.py | 6 +++++- ocs_ci/utility/tests/test_prometheus.py | 5 +++-- tests/conftest.py | 8 ++++---- tests/cross_functional/ui/test_odf_topology.py | 4 +--- .../test_nfs_feature_enable_for_ODF_clusters.py | 4 ++-- .../object/mcg/test_bucket_delete_using_obc_creds.py | 4 ++-- tests/functional/object/mcg/test_multi_region.py | 3 ++- .../functional/object/mcg/test_noobaa_db_pg_expansion.py | 5 +++-- tests/functional/object/mcg/test_pv_pool.py | 2 +- tests/functional/object/mcg/test_s3_regenerate_creds.py | 6 +++--- .../functional/object/mcg/test_virtual_hosted_buckets.py | 5 ++--- .../functional/pod_and_daemons/test_csi_logs_rotation.py | 4 ++-- .../functional/pv/add_metadata_feature/test_metadata.py | 8 +++++--- .../pv/pv_services/test_cr_resources_validation.py | 4 +++- tests/functional/storageclass/test_replica1.py | 9 ++++++--- 22 files changed, 61 insertions(+), 48 deletions(-) diff --git a/ocs_ci/deployment/hosted_cluster.py b/ocs_ci/deployment/hosted_cluster.py index 066ea0b292f..1d9f76e6ef8 100644 --- a/ocs_ci/deployment/hosted_cluster.py +++ b/ocs_ci/deployment/hosted_cluster.py @@ -917,7 +917,7 @@ def get_onboarding_key(self): str: onboarding token key """ secret_ocp_obj = ocp.OCP( - kind=constants.SECRET, namespace=constants.OPENSHIFT_STORAGE_NAMESPACE + kind=constants.SECRET, namespace=config.ENV_DATA["cluster_namespace"] ) key = ( @@ -1160,7 +1160,7 @@ def get_provider_address(self): """ Get the provider address """ - ocp = OCP(namespace=constants.OPENSHIFT_STORAGE_NAMESPACE) + ocp = OCP(namespace=config.ENV_DATA["cluster_namespace"]) storage_provider_endpoint = ocp.exec_oc_cmd( ( "get storageclusters.ocs.openshift.io -o jsonpath={'.items[*].status.storageProviderEndpoint'}" @@ -1210,7 +1210,7 @@ def storage_claim_exists_cephfs(self): else: ocp = OCP( kind=constants.STORAGECLAIM, - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE, + namespace=config.ENV_DATA["cluster_namespace"], cluster_kubeconfig=self.cluster_kubeconfig, ) @@ -1297,7 +1297,7 @@ def storage_claim_exists_rbd(self): else: ocp = OCP( kind=constants.STORAGECLAIM, - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE, + namespace=config.ENV_DATA["cluster_namespace"], cluster_kubeconfig=self.cluster_kubeconfig, ) diff --git a/ocs_ci/deployment/provider_client/storage_client_deployment.py b/ocs_ci/deployment/provider_client/storage_client_deployment.py index 84cf6bd118e..2af97a2205d 100644 --- a/ocs_ci/deployment/provider_client/storage_client_deployment.py +++ b/ocs_ci/deployment/provider_client/storage_client_deployment.py @@ -271,7 +271,7 @@ def provider_and_native_client_installation( if self.ocs_version >= version.VERSION_4_16: # Validate native client is created in openshift-storage namespace self.deployment.wait_for_csv( - self.ocs_client_operator, constants.OPENSHIFT_STORAGE_NAMESPACE + self.ocs_client_operator, config.ENV_DATA["cluster_namespace"] ) # Verify native storageclient is created successfully diff --git a/ocs_ci/helpers/helpers.py b/ocs_ci/helpers/helpers.py index 86f17363e18..e3fca3a7176 100644 --- a/ocs_ci/helpers/helpers.py +++ b/ocs_ci/helpers/helpers.py @@ -615,7 +615,7 @@ def create_ceph_block_pool( def create_ceph_file_system( - cephfs_name=None, label=None, namespace=constants.OPENSHIFT_STORAGE_NAMESPACE + cephfs_name=None, label=None, namespace=config.ENV_DATA["cluster_namespace"] ): """ Create a Ceph file system diff --git a/ocs_ci/ocs/bucket_utils.py b/ocs_ci/ocs/bucket_utils.py index 19236b8bdcd..9b6089f110b 100644 --- a/ocs_ci/ocs/bucket_utils.py +++ b/ocs_ci/ocs/bucket_utils.py @@ -1090,7 +1090,7 @@ def check_pv_backingstore_status( def check_pv_backingstore_type( backingstore_name=constants.DEFAULT_NOOBAA_BACKINGSTORE, - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE, + namespace=config.ENV_DATA["cluster_namespace"], ): """ check if existing pv backing store is in READY state diff --git a/ocs_ci/ocs/replica_one.py b/ocs_ci/ocs/replica_one.py index 91b310d72be..5b6c050a9ce 100644 --- a/ocs_ci/ocs/replica_one.py +++ b/ocs_ci/ocs/replica_one.py @@ -13,7 +13,6 @@ from ocs_ci.ocs.constants import ( DEFAULT_CEPHBLOCKPOOL, DEFAULT_STORAGE_CLUSTER, - OPENSHIFT_STORAGE_NAMESPACE, OSD_APP_LABEL, CEPHBLOCKPOOL, STORAGECLASS, @@ -141,7 +140,9 @@ def scaledown_deployment(deployment_names: list[str]) -> None: """ log.info("Starts Scaledown deployments") - deployment_obj = OCP(kind=DEPLOYMENT, namespace=OPENSHIFT_STORAGE_NAMESPACE) + deployment_obj = OCP( + kind=DEPLOYMENT, namespace=config.ENV_DATA["cluster_namespace"] + ) for deployment in deployment_names: deployment_obj.exec_oc_cmd(f"scale deployment {deployment} --replicas=0") log.info(f"scaling to 0: {deployment}") @@ -221,7 +222,7 @@ def modify_replica1_osd_count(new_osd_count): """ storage_cluster = OCP(kind=STORAGECLUSTER, name=DEFAULT_STORAGE_CLUSTER) storage_cluster.exec_oc_cmd( - f"patch storagecluster {DEFAULT_STORAGE_CLUSTER} -n {OPENSHIFT_STORAGE_NAMESPACE} " + f"patch storagecluster {DEFAULT_STORAGE_CLUSTER} -n {config.ENV_DATA['cluster_namespace']} " f'--type json --patch \'[{{"op": "replace", "path": ' f'"/spec/managedResources/cephNonResilientPools/count", "value": {new_osd_count} }}]\'' ) diff --git a/ocs_ci/ocs/resources/pod.py b/ocs_ci/ocs/resources/pod.py index 69e4f626781..5e9398a1eb5 100644 --- a/ocs_ci/ocs/resources/pod.py +++ b/ocs_ci/ocs/resources/pod.py @@ -796,7 +796,7 @@ def get_ceph_tools_pod( cluster_kubeconfig = config.ENV_DATA.get("provider_kubeconfig", "") if cluster_kubeconfig: - namespace = constants.OPENSHIFT_STORAGE_NAMESPACE + namespace = config.ENV_DATA["cluster_namespace"] else: namespace = namespace or config.ENV_DATA["cluster_namespace"] @@ -1574,7 +1574,7 @@ def run_io_and_verify_mount_point(pod_obj, bs="10M", count="950"): def get_pods_having_label( label, - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE, + namespace=config.ENV_DATA["cluster_namespace"], retry=0, cluster_config=None, statuses=None, @@ -3727,7 +3727,7 @@ def get_mon_pod_by_pvc_name(pvc_name: str): return Pod(**mon_pod_ocp) -def get_debug_pods(debug_nodes, namespace=constants.OPENSHIFT_STORAGE_NAMESPACE): +def get_debug_pods(debug_nodes, namespace=config.ENV_DATA["cluster_namespace"]): """ Get debug pods created for the nodes in debug @@ -3752,7 +3752,7 @@ def get_debug_pods(debug_nodes, namespace=constants.OPENSHIFT_STORAGE_NAMESPACE) def wait_for_pods_deletion( - label, timeout=120, sleep=5, namespace=constants.OPENSHIFT_STORAGE_NAMESPACE + label, timeout=120, sleep=5, namespace=config.ENV_DATA["cluster_namespace"] ): """ Wait for the pods with particular label to be deleted diff --git a/ocs_ci/ocs/resources/stretchcluster.py b/ocs_ci/ocs/resources/stretchcluster.py index 91273f8a5ff..0d7f52b8d13 100644 --- a/ocs_ci/ocs/resources/stretchcluster.py +++ b/ocs_ci/ocs/resources/stretchcluster.py @@ -5,6 +5,7 @@ from datetime import timedelta +from ocs_ci.framework import config from ocs_ci.ocs.resources import pod from ocs_ci.ocs.node import get_nodes_having_label, get_ocs_nodes, get_node_objs from ocs_ci.ocs.resources.ocs import OCS @@ -542,7 +543,7 @@ def reset_conn_score(self): Reset connection scores for all the mon's """ - mon_pods = get_mon_pods(namespace=constants.OPENSHIFT_STORAGE_NAMESPACE) + mon_pods = get_mon_pods(namespace=config.ENV_DATA["cluster_namespace"]) for pod_obj in mon_pods: mon_pod_id = get_mon_pod_id(pod_obj) cmd = f"ceph daemon mon.{mon_pod_id} connection scores reset" diff --git a/ocs_ci/ocs/ui/validation_ui.py b/ocs_ci/ocs/ui/validation_ui.py index ccfc28ead72..c6d2819bc6f 100644 --- a/ocs_ci/ocs/ui/validation_ui.py +++ b/ocs_ci/ocs/ui/validation_ui.py @@ -98,7 +98,11 @@ def verify_ocs_operator_tabs(self): ) logger.info("Verify Details tab on OCS operator") - strings_details_tab = ["Description", "Succeeded", "openshift-storage"] + strings_details_tab = [ + "Description", + "Succeeded", + config.ENV_DATA["cluster_namespace"], + ] self.verify_page_contain_strings( strings_on_page=strings_details_tab, page_name="details_tab" ) diff --git a/ocs_ci/utility/tests/test_prometheus.py b/ocs_ci/utility/tests/test_prometheus.py index 971f95f75ff..41c8130ef18 100644 --- a/ocs_ci/utility/tests/test_prometheus.py +++ b/ocs_ci/utility/tests/test_prometheus.py @@ -2,6 +2,7 @@ import pytest +from ocs_ci.framework import config from ocs_ci.utility.prometheus import check_query_range_result_enum @@ -22,7 +23,7 @@ def query_range_result_ok(): "endpoint": "http-metrics", "instance": "10.131.0.36:9283", "job": "rook-ceph-mgr", - "namespace": "openshift-storage", + "namespace": config.ENV_DATA["cluster_namespace"], "pod": "rook-ceph-mgr-a-66df496d9d-snssn", "service": "rook-ceph-mgr", }, @@ -52,7 +53,7 @@ def query_range_result_ok(): "endpoint": "http-metrics", "instance": "10.131.0.36:9283", "job": "rook-ceph-mgr", - "namespace": "openshift-storage", + "namespace": config.ENV_DATA["cluster_namespace"], "pod": "rook-ceph-mgr-a-66df496d9d-snssn", "service": "rook-ceph-mgr", }, diff --git a/tests/conftest.py b/tests/conftest.py index 6bbc7b5ec83..8820bac797b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,7 +24,7 @@ from ocs_ci.deployment import factory as dep_factory from ocs_ci.deployment.helpers.hypershift_base import HyperShiftBase from ocs_ci.deployment.hosted_cluster import HostedClients -from ocs_ci.framework import config as ocsci_config, Config +from ocs_ci.framework import config as ocsci_config, Config, config import ocs_ci.framework.pytest_customization.marks from ocs_ci.framework.pytest_customization.marks import ( deployment, @@ -8029,7 +8029,7 @@ def factory(min_ep_count=3, max_ep_count=3, cpu=6, memory="10Gi"): storagecluster_obj = OCP( kind=constants.STORAGECLUSTER, resource_name=constants.DEFAULT_STORAGE_CLUSTER, - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE, + namespace=config.ENV_DATA["cluster_namespace"], ) scale_endpoint_pods_param = ( @@ -8346,7 +8346,7 @@ def factory(pv_size="50"): get_pods_having_label( label=label, retry=5, - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE, + namespace=config.ENV_DATA["cluster_namespace"], ) ) @@ -8371,7 +8371,7 @@ def finalizer(): get_pods_having_label( label=label, retry=5, - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE, + namespace=config.ENV_DATA["cluster_namespace"], ) ) diff --git a/tests/cross_functional/ui/test_odf_topology.py b/tests/cross_functional/ui/test_odf_topology.py index b99a2adee04..0945675d717 100644 --- a/tests/cross_functional/ui/test_odf_topology.py +++ b/tests/cross_functional/ui/test_odf_topology.py @@ -123,9 +123,7 @@ def test_validate_topology_configuration( interface=constants.CEPHBLOCKPOOL, access_mode=constants.ACCESS_MODE_RWO, status=constants.STATUS_BOUND, - project=OCP( - kind="Project", namespace=constants.OPENSHIFT_STORAGE_NAMESPACE - ), + project=OCP(kind="Project", namespace=config.ENV_DATA["cluster_namespace"]), ) pod_obj = helpers.create_pod( interface_type=constants.CEPHBLOCKPOOL, diff --git a/tests/functional/nfs_feature/test_nfs_feature_enable_for_ODF_clusters.py b/tests/functional/nfs_feature/test_nfs_feature_enable_for_ODF_clusters.py index a84eeea14d4..9e198aa0d85 100644 --- a/tests/functional/nfs_feature/test_nfs_feature_enable_for_ODF_clusters.py +++ b/tests/functional/nfs_feature/test_nfs_feature_enable_for_ODF_clusters.py @@ -64,7 +64,7 @@ def test_nfs_not_enabled_by_default(self): """ storage_cluster_obj = ocp.OCP( - kind="Storagecluster", namespace="openshift-storage" + kind="Storagecluster", namespace=config.ENV_DATA["cluster_namespace"] ) # Checks cephnfs resources not available by default cephnfs_resource = storage_cluster_obj.exec_oc_cmd("get cephnfs") @@ -125,7 +125,7 @@ def setup_teardown(self, request): """ self = request.node.cls log.info("-----Setup-----") - self.namespace = "openshift-storage" + self.namespace = config.ENV_DATA["cluster_namespace"] self.storage_cluster_obj = ocp.OCP( kind="Storagecluster", namespace=self.namespace ) diff --git a/tests/functional/object/mcg/test_bucket_delete_using_obc_creds.py b/tests/functional/object/mcg/test_bucket_delete_using_obc_creds.py index 9e9ba73b2f1..59d5d68a724 100644 --- a/tests/functional/object/mcg/test_bucket_delete_using_obc_creds.py +++ b/tests/functional/object/mcg/test_bucket_delete_using_obc_creds.py @@ -2,6 +2,7 @@ import boto3 import logging +from ocs_ci.framework import config from ocs_ci.framework.pytest_customization.marks import ( tier2, bugzilla, @@ -15,7 +16,6 @@ from ocs_ci.ocs.ocp import OCP import botocore.exceptions as boto3exception from ocs_ci.ocs.constants import ( - OPENSHIFT_STORAGE_NAMESPACE, SECRET, ) from ocs_ci.ocs.exceptions import UnexpectedBehaviour @@ -41,7 +41,7 @@ def test_bucket_delete_using_obc_creds(mcg_obj, bucket_factory): logger.info("Creating OBC") bucket = bucket_factory(amount=1, interface="OC")[0].name # Fetch OBC credentials - secret_ocp_obj = OCP(kind=SECRET, namespace=OPENSHIFT_STORAGE_NAMESPACE) + secret_ocp_obj = OCP(kind=SECRET, namespace=config.ENV_DATA["cluster_namespace"]) obc_secret_obj = secret_ocp_obj.get(bucket) obc_access_key = base64.b64decode( obc_secret_obj.get("data").get("AWS_ACCESS_KEY_ID") diff --git a/tests/functional/object/mcg/test_multi_region.py b/tests/functional/object/mcg/test_multi_region.py index 9a7fb7544d2..c05d1d3da45 100644 --- a/tests/functional/object/mcg/test_multi_region.py +++ b/tests/functional/object/mcg/test_multi_region.py @@ -2,6 +2,7 @@ import pytest +from ocs_ci.framework import config from ocs_ci.framework.pytest_customization.marks import ( tier1, tier4a, @@ -200,7 +201,7 @@ def test_multiregion_spread_to_mirror( bucket = bucket_factory(1, "OC", bucketclass=bucket_class)[0] bucketclass_obj = ocp.OCP( kind=constants.BUCKETCLASS, - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE, + namespace=config.ENV_DATA["cluster_namespace"], resource_name=bucket.bucketclass.name, ) # Patch bucket class to update placement from "Spread" to "Mirror" diff --git a/tests/functional/object/mcg/test_noobaa_db_pg_expansion.py b/tests/functional/object/mcg/test_noobaa_db_pg_expansion.py index 4a753d1010b..01d41b8697a 100644 --- a/tests/functional/object/mcg/test_noobaa_db_pg_expansion.py +++ b/tests/functional/object/mcg/test_noobaa_db_pg_expansion.py @@ -1,5 +1,6 @@ import logging +from ocs_ci.framework import config from ocs_ci.utility import utils from ocs_ci.framework.pytest_customization.marks import ( vsphere_platform_required, @@ -40,7 +41,7 @@ def test_noobaa_db_pg_expansion(self, scale_noobaa_db_pod_pv_size): try: ceph_toolbox = get_ceph_tools_pod( - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE + namespace=config.ENV_DATA["cluster_namespace"] ) except (AssertionError, CephToolBoxNotFoundException) as ex: raise CommandFailed(ex) @@ -74,7 +75,7 @@ def test_noobaa_db_pg_expansion(self, scale_noobaa_db_pod_pv_size): # Verify default backingstore is in ready state or not default_bs = OCP( - kind=constants.BACKINGSTORE, namespace=constants.OPENSHIFT_STORAGE_NAMESPACE + kind=constants.BACKINGSTORE, namespace=config.ENV_DATA["cluster_namespace"] ).get(resource_name=constants.DEFAULT_NOOBAA_BACKINGSTORE) assert ( default_bs["status"]["phase"] == constants.STATUS_READY diff --git a/tests/functional/object/mcg/test_pv_pool.py b/tests/functional/object/mcg/test_pv_pool.py index a838d0dd3fe..88416e74e73 100644 --- a/tests/functional/object/mcg/test_pv_pool.py +++ b/tests/functional/object/mcg/test_pv_pool.py @@ -373,7 +373,7 @@ def test_pvpool_bs_in_fips(self, backingstore_factory): # the backingstore has reached Rejected state pv_bs_obj = OCP( kind=constants.BACKINGSTORE, - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE, + namespace=config.ENV_DATA["cluster_namespace"], resource_name=pv_backingstore.name, ) assert pv_bs_obj.wait_for_resource( diff --git a/tests/functional/object/mcg/test_s3_regenerate_creds.py b/tests/functional/object/mcg/test_s3_regenerate_creds.py index 52a77e7f4c8..56170e72cda 100644 --- a/tests/functional/object/mcg/test_s3_regenerate_creds.py +++ b/tests/functional/object/mcg/test_s3_regenerate_creds.py @@ -1,5 +1,6 @@ import logging +from ocs_ci.framework import config from ocs_ci.framework.pytest_customization.marks import ( tier2, bugzilla, @@ -9,7 +10,6 @@ mcg, ) from ocs_ci.ocs.ocp import OCP -from ocs_ci.ocs import constants logger = logging.getLogger(__name__) @@ -37,14 +37,14 @@ def test_s3_regenerate_creds(mcg_obj, project_factory): logger.info(f"Creating OBC {obc_name}") mcg_obj.exec_mcg_cmd( cmd=f"obc create {obc_name} --app-namespace {proj_name}", - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE, + namespace=config.ENV_DATA["cluster_namespace"], ) ocp_obj.get(resource_name=obc_name) # regenerate credential mcg_obj.exec_mcg_cmd( cmd=f"obc regenerate {obc_name} --app-namespace {proj_name}", - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE, + namespace=config.ENV_DATA["cluster_namespace"], use_yes=True, ) logger.info("Successfully regenerated s3 credentials") diff --git a/tests/functional/object/mcg/test_virtual_hosted_buckets.py b/tests/functional/object/mcg/test_virtual_hosted_buckets.py index 127dafbc8c5..f38a99798ea 100644 --- a/tests/functional/object/mcg/test_virtual_hosted_buckets.py +++ b/tests/functional/object/mcg/test_virtual_hosted_buckets.py @@ -1,9 +1,8 @@ import logging - +from ocs_ci.framework import config from ocs_ci.ocs.ocp import OCP from ocs_ci.ocs.resources.ocs import OCS -from ocs_ci.ocs import constants from ocs_ci.ocs.bucket_utils import ( verify_s3_object_integrity, write_random_objects_in_pod, @@ -45,7 +44,7 @@ def test_virtual_hosted_bucket( # create a route for the bucket create above s3_route_data = OCP( kind="route", - namespace=constants.OPENSHIFT_STORAGE_NAMESPACE, + namespace=config.ENV_DATA["cluster_namespace"], resource_name="s3", ).get() host_base = f'{s3_route_data["spec"]["host"]}' diff --git a/tests/functional/pod_and_daemons/test_csi_logs_rotation.py b/tests/functional/pod_and_daemons/test_csi_logs_rotation.py index afa1160db0b..3823008abe4 100644 --- a/tests/functional/pod_and_daemons/test_csi_logs_rotation.py +++ b/tests/functional/pod_and_daemons/test_csi_logs_rotation.py @@ -2,9 +2,9 @@ import logging import pytest +from ocs_ci.framework import config from ocs_ci.framework.testlib import BaseTest from ocs_ci.ocs.resources import pod -from ocs_ci.ocs.constants import OPENSHIFT_STORAGE_NAMESPACE from ocs_ci.framework.pytest_customization.marks import ( brown_squad, tier2, @@ -161,7 +161,7 @@ def test_pods_csi_log_rotation( """ csi_interface_plugin_pod_objs = pod.get_all_pods( - namespace=OPENSHIFT_STORAGE_NAMESPACE, selector=[pod_selector] + namespace=config.ENV_DATA["cluster_namespace"], selector=[pod_selector] ) # check on the first pod diff --git a/tests/functional/pv/add_metadata_feature/test_metadata.py b/tests/functional/pv/add_metadata_feature/test_metadata.py index 22c87a80463..bccd6c60045 100644 --- a/tests/functional/pv/add_metadata_feature/test_metadata.py +++ b/tests/functional/pv/add_metadata_feature/test_metadata.py @@ -68,7 +68,7 @@ def test_metadata_feature_unavailable_for_previous_versions( config_map_obj = ocp.OCP( kind="Configmap", namespace=config.ENV_DATA["cluster_namespace"] ) - pod_obj = ocp.OCP(kind="Pod", namespace="openshift-storage") + pod_obj = ocp.OCP(kind="Pod", namespace=config.ENV_DATA["cluster_namespace"]) toolbox = pod.get_ceph_tools_pod() project_factory_class(project_name="test-metadata") enable_metadata = '{"data":{"CSI_ENABLE_METADATA": "true"}}' @@ -179,8 +179,10 @@ def test_metadata_not_enabled_by_default( fs, sc_name = metadata_utils.update_testdata_for_external_modes( sc_name, fs, external_mode=external_mode ) - config_map_obj = ocp.OCP(kind="Configmap", namespace="openshift-storage") - pod_obj = ocp.OCP(kind="Pod", namespace="openshift-storage") + config_map_obj = ocp.OCP( + kind="Configmap", namespace=config.ENV_DATA["cluster_namespace"] + ) + pod_obj = ocp.OCP(kind="Pod", namespace=config.ENV_DATA["cluster_namespace"]) toolbox = pod.get_ceph_tools_pod() # enable metadata flag not available by default metadata_flag = config_map_obj.exec_oc_cmd( diff --git a/tests/functional/pv/pv_services/test_cr_resources_validation.py b/tests/functional/pv/pv_services/test_cr_resources_validation.py index 8ead04c58f1..1324d769acc 100644 --- a/tests/functional/pv/pv_services/test_cr_resources_validation.py +++ b/tests/functional/pv/pv_services/test_cr_resources_validation.py @@ -4,6 +4,8 @@ import yaml from tempfile import NamedTemporaryFile + +from ocs_ci.framework import config from ocs_ci.framework.pytest_customization.marks import bugzilla, green_squad from ocs_ci.framework.testlib import ( skipif_ocp_version, @@ -66,7 +68,7 @@ def cr_resource_not_editable( cr_resource_yaml, non_editable_patches, editable_patches, - namespace="openshift-storage", + namespace=config.ENV_DATA["cluster_namespace"], ): """ Test that cr object is not editable once created diff --git a/tests/functional/storageclass/test_replica1.py b/tests/functional/storageclass/test_replica1.py index ef1e4cfae28..b30a6f23f80 100644 --- a/tests/functional/storageclass/test_replica1.py +++ b/tests/functional/storageclass/test_replica1.py @@ -25,7 +25,6 @@ VOLUME_MODE_BLOCK, CSI_RBD_RAW_BLOCK_POD_YAML, DEFALUT_DEVICE_CLASS, - OPENSHIFT_STORAGE_NAMESPACE, ) from ocs_ci.helpers.helpers import create_pvc from ocs_ci.utility.utils import validate_dict_values, compare_dictionaries @@ -92,7 +91,9 @@ def replica1_setup(self): for osd in osd_names: pod = OCP( - kind=POD, namespace=OPENSHIFT_STORAGE_NAMESPACE, resource_name=osd + kind=POD, + namespace=config.ENV_DATA["cluster_namespace"], + resource_name=osd, ) pod.wait_for_resource(condition=STATUS_RUNNING, column="STATUS") @@ -103,7 +104,9 @@ def replica1_teardown(self, request, replica1_setup): yield log.info("Teardown function called") storage_cluster = replica1_setup - cephblockpools = OCP(kind=CEPHBLOCKPOOL, namespace=OPENSHIFT_STORAGE_NAMESPACE) + cephblockpools = OCP( + kind=CEPHBLOCKPOOL, namespace=config.ENV_DATA["cluster_namespace"] + ) set_non_resilient_pool(storage_cluster, enable=False) delete_replica_1_sc() log.info("StorageClass Deleted")