From 58c7c7e8f42f038dbabf056ba660363ce3822c64 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Tue, 26 May 2020 17:30:03 +0530 Subject: [PATCH] test_cephfs_shell: run cephfs-shell with conf file 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 --- qa/tasks/cephfs/test_cephfs_shell.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/qa/tasks/cephfs/test_cephfs_shell.py b/qa/tasks/cephfs/test_cephfs_shell.py index 48c143b70e3..3df72b9fc39 100644 --- a/qa/tasks/cephfs/test_cephfs_shell.py +++ b/qa/tasks/cephfs/test_cephfs_shell.py @@ -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)) -- 2.39.5