From: dparmar18 Date: Tue, 21 Feb 2023 18:08:42 +0000 (+0530) Subject: qa: fix helper function _check_nfs_cluster_status() X-Git-Tag: v16.2.14~124^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=75c5e460343f003dad66fa37a35fb0121baad5af;p=ceph.git 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) --- diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index e9a6e6b40b7e..190dd62a9114 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -107,13 +107,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):