]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: fix testcase 'test_cluster_set_user_config_with_non_existing_clusterid'
authordparmar18 <dparmar@redhat.com>
Fri, 17 Feb 2023 18:35:19 +0000 (00:05 +0530)
committerDhairya Parmar <dparmar@redhat.com>
Thu, 30 Mar 2023 13:59:15 +0000 (19:29 +0530)
Fixes: https://tracker.ceph.com/issues/58758
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
qa/tasks/cephfs/test_nfs.py

index 1fe727dbb06352463452112c63efb3e9e154f62e..e8f27a377d0d1f04abb9242ced222576a2152dcf 100644 (file)
@@ -646,15 +646,20 @@ class TestNFS(MgrTestCase):
         '''
         Test setting user config for non-existing nfs cluster.
         '''
-        try:
-            cluster_id = 'invalidtest'
-            self.ctx.cluster.run(args=['ceph', 'nfs', 'cluster',
-                'config', 'set', self.cluster_id, '-i', '-'], stdin='testing')
-            self.fail(f"User config set for non-existing cluster {cluster_id}")
-        except CommandFailedError as e:
-            # Command should fail for test to pass
-            if e.exitstatus != errno.ENOENT:
-                raise
+        cluster_id = 'invalidtest'
+        with contextutil.safe_while(sleep=3, tries=3) as proceed:
+            while proceed():
+                try:
+                    self.ctx.cluster.run(args=['ceph', 'nfs', 'cluster',
+                                               'config', 'set', cluster_id,
+                                               '-i', '-'], stdin='testing')
+                    self.fail(f"User config set for non-existing cluster"
+                              f"{cluster_id}")
+                except CommandFailedError as e:
+                    # Command should fail for test to pass
+                    if e.exitstatus == errno.ENOENT:
+                        break
+                    log.warning('exitstatus != ENOENT, retrying')
 
     def test_cluster_reset_user_config_with_non_existing_clusterid(self):
         '''