]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: fix helper function _check_nfs_cluster_status()
authordparmar18 <dparmar@redhat.com>
Tue, 21 Feb 2023 18:08:42 +0000 (23:38 +0530)
committerDhairya Parmar <dparmar@redhat.com>
Thu, 30 Mar 2023 13:59:15 +0000 (19:29 +0530)
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 <dparmar@redhat.com>
qa/tasks/cephfs/test_nfs.py

index e8f27a377d0d1f04abb9242ced222576a2152dcf..5effb98b79116bdac036fec90d973a5b77bfb576 100644 (file)
@@ -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):