]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/tasks: add/update tests for --yes-i-really-mean-it
authorJos Collin <jcollin@redhat.com>
Tue, 17 Sep 2019 06:46:35 +0000 (12:16 +0530)
committerJos Collin <jcollin@redhat.com>
Fri, 27 Sep 2019 09:47:34 +0000 (15:17 +0530)
Fixes: https://tracker.ceph.com/issues/41841
Signed-off-by: Jos Collin <jcollin@redhat.com>
qa/tasks/cephfs/test_volumes.py

index 98fd17b478d61c42c3cff48ca886cb0c9dff224a..2155c0d5fa98b921c6bdffbbd4c2d95366532c7d 100644 (file)
@@ -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):