]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa: add wrappers for vstart's run() with check_status as False
authorRishabh Dave <ridave@redhat.com>
Wed, 13 Mar 2019 18:40:16 +0000 (00:10 +0530)
committerRishabh Dave <ridave@redhat.com>
Wed, 17 Apr 2019 18:28:22 +0000 (23:58 +0530)
Too often in tests it is required to run a command that we want to (or
will probably) fail so that we can check if it failed for expected
reason(s) (eg. a testcase where command must fail with "Permission
denied"). Therefore, add few wrapper methods for vstart_runner.py's
run() with check_status's default value as False so that we don't need
to pass check_status's value at every call to run() or it's other
wrappers.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
qa/tasks/vstart_runner.py

index f2dc0972a0c55f1c15c350a4a44f398db1e426f5..2edc88d3d78d4de4f2b59b87cd97497c4ddd58e9 100644 (file)
@@ -498,6 +498,27 @@ class LocalFuseMount(FuseMount):
                                       check_status=check_status,
                                       omit_sudo=False)
 
+    def testcmd(self, args, wait=True, stdin=None, omit_sudo=True):
+        # FIXME maybe should add a pwd arg to teuthology.orchestra so that
+        # the "cd foo && bar" shenanigans isn't needed to begin with and
+        # then we wouldn't have to special case this
+        return self.run_shell(args, wait=wait, stdin=stdin, check_status=False,
+                              omit_sudo=omit_sudo)
+
+    def testcmd_as_user(self, args, user, wait=True, stdin=None):
+        # FIXME maybe should add a pwd arg to teuthology.orchestra so that
+        # the "cd foo && bar" shenanigans isn't needed to begin with and
+        # then we wouldn't have to special case this
+        return self.run_as_user(args, user=user, wait=wait, stdin=stdin,
+                                check_status=False)
+
+    def testcmd_as_root(self, args, wait=True, stdin=None):
+        # FIXME maybe should add a pwd arg to teuthology.orchestra so that
+        # the "cd foo && bar" shenanigans isn't needed to begin with and
+        # then we wouldn't have to special case this
+        return self.run_as_root(args, wait=wait, stdin=stdin,
+                                check_status=False)
+
     def setupfs(self, name=None):
         if name is None and self.fs is not None:
             # Previous mount existed, reuse the old name