From c8f6a25ca4f5c4ec870bfed81d640ea2aa5cc7bb Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Tue, 10 Sep 2019 17:03:48 +0530 Subject: [PATCH] qa/tasks: Fix the commands success * 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 --- qa/tasks/cephfs/test_volumes.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/qa/tasks/cephfs/test_volumes.py b/qa/tasks/cephfs/test_volumes.py index 56e8dcc3579..024e60d9e9d 100644 --- a/qa/tasks/cephfs/test_volumes.py +++ b/qa/tasks/cephfs/test_volumes.py @@ -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) -- 2.39.5