From b59fa49a26e75c4846f9c0efd120c76990234090 Mon Sep 17 00:00:00 2001 From: dparmar18 Date: Sat, 18 Feb 2023 00:05:19 +0530 Subject: [PATCH] qa: fix testcase 'test_cluster_set_user_config_with_non_existing_clusterid' Fixes: https://tracker.ceph.com/issues/58758 Signed-off-by: Dhairya Parmar (cherry picked from commit 3b3fa71edfad45a4f8b9085dd109b756d1f0778b) --- qa/tasks/cephfs/test_nfs.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index 8dfd88b96c16e..e9a6e6b40b7e3 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -640,15 +640,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): ''' -- 2.39.5