]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test_cephfs_shell: run cephfs-shell with conf file 32111/head
authorRishabh Dave <ridave@redhat.com>
Tue, 26 May 2020 12:00:03 +0000 (17:30 +0530)
committerRishabh Dave <ridave@redhat.com>
Wed, 17 Jun 2020 11:51:31 +0000 (17:21 +0530)
And set colors to False and debug to True in this conf file.

stdout captured by Python code in this testsuite can contain the colour
codes along with the expected string output. Setting colors to False in
cephfs-shell.conf should fix this.

Setting debug to False should help with analyzing test failures since
it enables printing messages that helps debugging (stacktrace for
cephfs-shell code, for example).

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

index 48c143b70e3f58d9484df7d7851a0075177805dd..3df72b9fc3987ba8a2991d4ce222901141fd2ebc 100644 (file)
@@ -34,6 +34,15 @@ def humansize(nbytes):
 class TestCephFSShell(CephFSTestCase):
     CLIENTS_REQUIRED = 1
 
+    def setUp(self):
+        super(TestCephFSShell, self).setUp()
+
+        conf_contents = "[cephfs-shell]\ncolors = False\ndebug = True\n"
+        confpath = self.mount_a.run_shell(args=['mktemp']).stdout.\
+            getvalue().strip()
+        sudo_write_file(self.mount_a.client_remote, confpath, conf_contents)
+        self.default_shell_conf_path = confpath
+
     def run_cephfs_shell_cmd(self, cmd, mount_x=None, shell_conf_path=None,
                              opts=None, stdout=None, stderr=None, stdin=None,
                              check_status=True):
@@ -41,13 +50,12 @@ class TestCephFSShell(CephFSTestCase):
         stderr = stderr or StringIO()
         if mount_x is None:
             mount_x = self.mount_a
-
         if isinstance(cmd, list):
             cmd = " ".join(cmd)
+        if not shell_conf_path:
+            shell_conf_path = self.default_shell_conf_path
 
-        args = ["cephfs-shell"]
-        if shell_conf_path:
-            args += ["-c", shell_conf_path]
+        args = ["cephfs-shell", "-c", shell_conf_path]
         if opts:
             args += opts
         args.extend(("--", cmd))