From: John Mulligan Date: Thu, 12 Jan 2023 18:47:49 +0000 (-0500) Subject: qa/test_nfs: fix test failure when cluster does not exist X-Git-Tag: v17.2.8~235^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3ff6a41db4f3986db7c951b50f610a9fbc2cbc91;p=ceph.git qa/test_nfs: fix test failure when cluster does not exist 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 (cherry picked from commit e03331e7c4412e33fe55d7a41a22dfeba17cb463) Fixes: https://tracker.ceph.com/issues/65644 --- diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index cebe2872de0..70bfa54ca83 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -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): """