]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks: Fix the commands success
authorJos Collin <jcollin@redhat.com>
Tue, 10 Sep 2019 11:33:48 +0000 (17:03 +0530)
committerRamana Raja <rraja@redhat.com>
Wed, 12 Feb 2020 10:11:59 +0000 (05:11 -0500)
* Raised RuntimeException when the commands, which were expected to fail succeed.
* Dropped some commands with --force remove commands, as it is unnecessary.

Signed-off-by: Jos Collin <jcollin@redhat.com>
(cherry picked from commit c8f6a25ca4f5c4ec870bfed81d640ea2aa5cc7bb)

qa/tasks/cephfs/test_volumes.py

index ee86401f20814ec8e9a2cc48a223b0bfef3e545f..6ecbc689cc191a315aee5945dcb7d2b7d79008bd 100644 (file)
@@ -153,6 +153,8 @@ class TestVolumes(CephFSTestCase):
         except CommandFailedError as ce:
             if ce.exitstatus != errno.ENOENT:
                 raise
+        else:
+            raise RuntimeError("expected the 'fs subvolume getpath' command to fail. Subvolume not removed.")
 
         # verify trash dir is clean
         self._wait_for_trash_empty()
@@ -422,7 +424,7 @@ class TestVolumes(CephFSTestCase):
             if ce.exitstatus != errno.ENOENT:
                 raise
         else:
-            raise RuntimeError("expected the `fs subvolume getpath` command to fail")
+            raise RuntimeError("expected the 'fs subvolume getpath' command to fail")
 
     def test_subvolume_create_with_invalid_size(self):
         # create subvolume with an invalid size -1
@@ -445,9 +447,8 @@ class TestVolumes(CephFSTestCase):
         except CommandFailedError as ce:
             if ce.exitstatus != errno.ENOENT:
                 raise
-
-        # force remove subvolume
-        self._fs_cmd("subvolume", "rm", self.volname, subvolume, "--force")
+        else:
+            raise RuntimeError("expected the 'fs subvolume rm' command to fail")
 
     def test_nonexistent_subvolume_group_create(self):
         subvolume = self._generate_random_subvolume_name()
@@ -459,6 +460,8 @@ class TestVolumes(CephFSTestCase):
         except CommandFailedError as ce:
             if ce.exitstatus != errno.ENOENT:
                 raise
+        else:
+            raise RuntimeError("expected the 'fs subvolume create' command to fail")
 
     def test_default_uid_gid_subvolume(self):
         subvolume = self._generate_random_subvolume_name()
@@ -779,7 +782,7 @@ class TestVolumes(CephFSTestCase):
         # remove subvolume
         self._fs_cmd("subvolume", "rm", self.volname, subvolname)
 
-    def test_nonexistent_subvolme_group_rm(self):
+    def test_nonexistent_subvolume_group_rm(self):
         group = "non_existent_group"
 
         # try, remove subvolume group
@@ -788,9 +791,8 @@ class TestVolumes(CephFSTestCase):
         except CommandFailedError as ce:
             if ce.exitstatus != errno.ENOENT:
                 raise
-
-        # force remove subvolume
-        self._fs_cmd("subvolumegroup", "rm", self.volname, group, "--force")
+        else:
+            raise RuntimeError("expected the 'fs subvolumegroup rm' command to fail")
 
     def test_default_uid_gid_subvolume_group(self):
         group = self._generate_random_group_name()
@@ -898,9 +900,8 @@ class TestVolumes(CephFSTestCase):
         except CommandFailedError as ce:
             if ce.exitstatus != errno.ENOENT:
                 raise
-
-        # force remove snapshot
-        self._fs_cmd("subvolume", "snapshot", "rm", self.volname, subvolume, snapshot, "--force")
+        else:
+            raise RuntimeError("expected the 'fs subvolume snapshot rm' command to fail")
 
         # remove subvolume
         self._fs_cmd("subvolume", "rm", self.volname, subvolume)
@@ -1034,6 +1035,8 @@ class TestVolumes(CephFSTestCase):
         except CommandFailedError as ce:
             if ce.exitstatus != errno.ENOENT:
                 raise
+        else:
+            raise RuntimeError("expected the 'fs subvolumegroup snapshot rm' command to fail")
 
         # remove subvolume
         self._fs_cmd("subvolume", "rm", self.volname, subvolume, group)