From eab60b5fad6d2e0166d40f255b9507eada831b87 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Tue, 16 Jun 2020 15:34:36 +0530 Subject: [PATCH] qa/tasks/cephfs: Add tests for export create with non-existing fsname and cluster id Signed-off-by: Varsha Rao --- qa/tasks/cephfs/test_nfs.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index 0880ba2bfdf..7ccae6c36cb 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -185,3 +185,26 @@ class TestNFS(MgrTestCase): self._orch_cmd("set", "backend", "cephadm") self._test_list_export() self._delete_export() + + def test_export_create_with_non_existing_fsname(self): + try: + fs_name = 'nfs-test' + self._test_create_cluster() + self._nfs_cmd('export', 'create', 'cephfs', fs_name, self.cluster_id, self.pseudo_path) + self.fail(f"Export created with non-existing filesystem {fs_name}") + except CommandFailedError as e: + # Command should fail for test to pass + if e.exitstatus != errno.ENOENT: + raise + finally: + self._test_delete_cluster() + + def test_export_create_with_non_existing_clusterid(self): + try: + cluster_id = 'invalidtest' + self._nfs_cmd('export', 'create', 'cephfs', self.fs_name, cluster_id, self.pseudo_path) + self.fail(f"Export created with non-existing cluster id {cluster_id}") + except CommandFailedError as e: + # Command should fail for test to pass + if e.exitstatus != errno.ENOENT: + raise -- 2.39.5