Skip to content

Commit

Permalink
Remove the try and except from the function 'get_mds_cache_memory_lim…
Browse files Browse the repository at this point in the history
…it', Remove the redundent line in the test 'test_check_mds_cache_memory_limit', update the 'retry' clause (#8719)

Signed-off-by: Itzhak Kave <[email protected]>
  • Loading branch information
yitzhak12 authored Oct 25, 2023
1 parent 7f16a45 commit 0bbd7bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
12 changes: 4 additions & 8 deletions ocs_ci/ocs/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 3 additions & 2 deletions tests/manage/z_cluster/test_ceph_default_values_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0bbd7bb

Please sign in to comment.