]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/test_nfs: fix test failure when cluster does not exist 56753/head
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 12 Jan 2023 18:47:49 +0000 (13:47 -0500)
committerDhairya Parmar <dparmar@redhat.com>
Wed, 24 Apr 2024 09:53:02 +0000 (15:23 +0530)
The patches that add object formatting / decorators to the nfs module
also made error handling more generic when accessing an nfs cluster and
now returns a nonzero exit code. A test was after the PR adding the
object format support that only checked an error message.
Update the test to match the new nfs module behavior as well as fixing a
typo.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit e03331e7c4412e33fe55d7a41a22dfeba17cb463)
Fixes: https://tracker.ceph.com/issues/65644
qa/tasks/cephfs/test_nfs.py

index cebe2872de0b29cd43601b97717d5343d0c0e132..70bfa54ca83f08de7ac627373a0465a61ce6d289 100644 (file)
@@ -812,10 +812,14 @@ class TestNFS(MgrTestCase):
         """
         Test that cluster info doesn't throw junk data for non-existent cluster
         """
-        cluseter_ls = self._nfs_cmd('cluster', 'ls')
-        self.assertNotIn('foo', cluseter_ls, 'cluster foo exists')
-        cluster_info = self._nfs_cmd('cluster', 'info', 'foo')
-        self.assertIn('cluster does not exist', cluster_info)
+        cluster_ls = self._nfs_cmd('cluster', 'ls')
+        self.assertNotIn('foo', cluster_ls, 'cluster foo exists')
+        try:
+            self._nfs_cmd('cluster', 'info', 'foo')
+            self.fail("nfs cluster info foo returned successfully for non-existent cluster")
+        except CommandFailedError as e:
+            if e.exitstatus != errno.ENOENT:
+                raise
 
     def test_nfs_export_with_invalid_path(self):
         """