From 0bbd7bba42560378d1720ee50bd7e4f6470e2601 Mon Sep 17 00:00:00 2001 From: Itzhak Kave Date: Wed, 25 Oct 2023 13:35:58 +0300 Subject: [PATCH] Remove the try and except from the function 'get_mds_cache_memory_limit', Remove the redundent line in the test 'test_check_mds_cache_memory_limit', update the 'retry' clause (#8719) Signed-off-by: Itzhak Kave --- ocs_ci/ocs/cluster.py | 12 ++++-------- .../z_cluster/test_ceph_default_values_check.py | 5 +++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ocs_ci/ocs/cluster.py b/ocs_ci/ocs/cluster.py index 3b0cee83722..dfd5ed8b50d 100644 --- a/ocs_ci/ocs/cluster.py +++ b/ocs_ci/ocs/cluster.py @@ -2027,14 +2027,10 @@ def get_mds_cache_memory_limit(): """ pod_obj = pod.get_ceph_tools_pod() - try: - ceph_cmd = "ceph config show mds.ocs-storagecluster-cephfilesystem-a mds_cache_memory_limit" - mds_a_cache_memory_limit = pod_obj.exec_ceph_cmd(ceph_cmd=ceph_cmd) - ceph_cmd = "ceph config show mds.ocs-storagecluster-cephfilesystem-b mds_cache_memory_limit" - mds_b_cache_memory_limit = pod_obj.exec_ceph_cmd(ceph_cmd=ceph_cmd) - except IOError as ioe: - if "ENOENT" not in ioe: - raise ioe + ceph_cmd = "ceph config show mds.ocs-storagecluster-cephfilesystem-a mds_cache_memory_limit" + mds_a_cache_memory_limit = pod_obj.exec_ceph_cmd(ceph_cmd=ceph_cmd) + ceph_cmd = "ceph config show mds.ocs-storagecluster-cephfilesystem-b mds_cache_memory_limit" + mds_b_cache_memory_limit = pod_obj.exec_ceph_cmd(ceph_cmd=ceph_cmd) if mds_a_cache_memory_limit != mds_b_cache_memory_limit: raise UnexpectedBehaviour( diff --git a/tests/manage/z_cluster/test_ceph_default_values_check.py b/tests/manage/z_cluster/test_ceph_default_values_check.py index 70c532350c8..80e5d4c3439 100644 --- a/tests/manage/z_cluster/test_ceph_default_values_check.py +++ b/tests/manage/z_cluster/test_ceph_default_values_check.py @@ -24,6 +24,7 @@ from ocs_ci.ocs.cluster import get_mds_cache_memory_limit from ocs_ci.utility import version from ocs_ci.utility.retry import retry +from ocs_ci.ocs.exceptions import CommandFailed log = logging.getLogger(__name__) @@ -155,12 +156,12 @@ def test_check_mds_cache_memory_limit(self): Testcase to check mds cache memory limit post ocs upgrade """ - mds_cache_memory_limit = get_mds_cache_memory_limit() mds_cache_memory_limit = retry( - (IOError), + (IOError, CommandFailed), tries=6, delay=20, backoff=1, + text_in_exception="ENOENT", )(get_mds_cache_memory_limit)() expected_mds_value = 4294967296 expected_mds_value_in_GB = int(expected_mds_value / 1073741274)