]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test_cephfs_shell: catch specific exception instead of catching all
authorRishabh Dave <ridave@redhat.com>
Tue, 21 Apr 2020 06:38:30 +0000 (12:08 +0530)
committerRishabh Dave <ridave@redhat.com>
Fri, 5 Jun 2020 04:11:17 +0000 (09:41 +0530)
Signed-off-by: Rishabh Dave <ridave@redhat.com>
qa/tasks/cephfs/test_cephfs_shell.py

index 20329ed035a9e1ed0913b98fb148343424bbc1f6..9799fa455f767c1d33ca2229dc6d51f37391bbd0 100644 (file)
@@ -178,7 +178,7 @@ class TestMkdir(TestCephFSShell):
         self.negtest_cephfs_shell_cmd(cmd="mkdir -m -0755 d3")
         try:
             self.mount_a.stat('d3')
-        except:
+        except CommandFailedError:
             pass
 
     def test_mkdir_with_non_octal_mode(self):
@@ -199,7 +199,7 @@ class TestMkdir(TestCephFSShell):
         self.negtest_cephfs_shell_cmd(cmd="mkdir -m ugx=0755 d5")
         try:
             self.mount_a.stat('d5')
-        except:
+        except CommandFailedError:
             pass
 
     def test_mkdir_path_without_path_option(self):
@@ -209,7 +209,7 @@ class TestMkdir(TestCephFSShell):
         self.negtest_cephfs_shell_cmd(cmd="mkdir d5/d6/d7")
         try:
             self.mount_a.stat('d5/d6/d7')
-        except:
+        except CommandFailedError:
             pass
 
     def test_mkdir_path_with_path_option(self):
@@ -456,7 +456,7 @@ class TestSnapshots(TestCephFSShell):
         self.assertEqual("", o)
         try:
             o = self.mount_a.stat(sdn)
-        except:
+        except CommandFailedError:
             # snap dir should not exist anymore
             pass
         log.info("mount_a output:\n{}".format(o))
@@ -467,7 +467,7 @@ class TestSnapshots(TestCephFSShell):
                                       errmsg="'snap1': no such snapshot")
         try:
             o = self.mount_a.stat(sdn)
-        except:
+        except CommandFailedError:
             pass
         log.info("mount_a output:\n{}".format(o))
         self.assertNotIn('st_mode', o)