From ecc90b8f116260b4c12382ddc7e7596d07043b96 Mon Sep 17 00:00:00 2001 From: dparmar18 Date: Tue, 21 Feb 2023 23:38:42 +0530 Subject: [PATCH] qa: fix helper function _check_nfs_cluster_status() Comment in the code says to wait for two minutes as cluster creation takes time but actually it's waiting for thirteen minutes, it's not required to wait this long, i think a minute here is more than enough, also switched to using safe_while(). Signed-off-by: Dhairya Parmar (cherry picked from commit 503f8679ed8ecadf47defbf4bb76abdcab009846) --- qa/tasks/cephfs/test_nfs.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index e8f27a377d0..5effb98b791 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -112,13 +112,12 @@ class TestNFS(MgrTestCase): :param expected_status: Status to be verified :param fail_msg: Message to be printed if test failed ''' - # Wait for two minutes as ganesha daemon takes some time to be deleted/created - wait_time = 10 - while wait_time <= 120: - time.sleep(wait_time) - if expected_status in self._fetch_nfs_daemons_details(): - return - wait_time += 10 + # Wait for a minute as ganesha daemon takes some time to be + # deleted/created + with contextutil.safe_while(sleep=6, tries=10, _raise=False) as proceed: + while proceed(): + if expected_status in self._fetch_nfs_daemons_details(): + return self.fail(fail_msg) def _check_auth_ls(self, export_id=1, check_in=False): -- 2.39.5