From e03331e7c4412e33fe55d7a41a22dfeba17cb463 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Thu, 12 Jan 2023 13:47:49 -0500 Subject: [PATCH] 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 --- qa/tasks/cephfs/test_nfs.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index 58490dea86a95..dc380610aa7c8 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -736,7 +736,11 @@ 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 -- 2.39.5