From: Jos Collin Date: Tue, 17 Sep 2019 06:46:35 +0000 (+0530) Subject: qa/tasks: add/update tests for --yes-i-really-mean-it X-Git-Tag: v15.1.0~1361^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f1b9e90d7f858496ef1053be9cfa59844b3247b3;p=ceph.git qa/tasks: add/update tests for --yes-i-really-mean-it Fixes: https://tracker.ceph.com/issues/41841 Signed-off-by: Jos Collin --- diff --git a/qa/tasks/cephfs/test_volumes.py b/qa/tasks/cephfs/test_volumes.py index 98fd17b478d6..2155c0d5fa98 100644 --- a/qa/tasks/cephfs/test_volumes.py +++ b/qa/tasks/cephfs/test_volumes.py @@ -63,7 +63,7 @@ class TestVolumes(CephFSTestCase): return path[1:].rstrip() def _delete_test_volume(self): - self._fs_cmd("volume", "rm", self.volname) + self._fs_cmd("volume", "rm", self.volname, "--yes-i-really-mean-it") def _do_subvolume_io(self, subvolume, number_of_files=DEFAULT_NUMBER_OF_FILES, file_size=DEFAULT_FILE_SIZE): @@ -95,6 +95,23 @@ class TestVolumes(CephFSTestCase): self._delete_test_volume() super(TestVolumes, self).tearDown() + def test_volume_rm(self): + try: + self._fs_cmd("volume", "rm", self.volname) + except CommandFailedError as ce: + if ce.exitstatus != errno.EPERM: + raise RuntimeError("expected the 'fs volume rm' command to fail with EPERM, " + "but it failed with {0}".format(ce.exitstatus)) + else: + self._fs_cmd("volume", "rm", self.volname, "--yes-i-really-mean-it") + + #check if it's gone + volumes = json.loads(self.mgr_cluster.mon_manager.raw_cluster_cmd('fs', 'volume', 'ls', '--format=json-pretty')) + if (self.volname in [volume['name'] for volume in volumes]): + raise RuntimeError("Expected the 'fs volume rm' command to succeed. The volume {0} not removed.".format(self.volname)) + else: + raise RuntimeError("expected the 'fs volume rm' command to fail.") + ### basic subvolume operations def test_subvolume_create_and_rm(self):