]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/tasks: Fix the commands success
authorJos Collin <jcollin@redhat.com>
Tue, 10 Sep 2019 11:33:48 +0000 (17:03 +0530)
committerJos Collin <jcollin@redhat.com>
Wed, 20 Nov 2019 06:39:12 +0000 (12:09 +0530)
* 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>
qa/tasks/cephfs/test_volumes.py

index 56e8dcc3579b9b23707c75c6830d91db2eca8bc0..024e60d9e9d6631e1ebef168caf52c3bb346acd1 100644 (file)
@@ -132,6 +132,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()
@@ -401,7 +403,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
@@ -424,9 +426,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()
@@ -438,6 +439,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()
@@ -759,7 +762,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
@@ -768,9 +771,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()
@@ -879,9 +881,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)
@@ -1016,6 +1017,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)