From f9b4d790e5ca965bde277f1f7ed46dc32cc7eb49 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Fri, 2 Aug 2019 01:52:22 +0530 Subject: [PATCH] test_cephfs_shell: test cephfs-shell command at invocation Verify that "cephfs-shell -c ceph.conf " works as expected. Signed-off-by: Rishabh Dave --- qa/tasks/cephfs/test_cephfs_shell.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/qa/tasks/cephfs/test_cephfs_shell.py b/qa/tasks/cephfs/test_cephfs_shell.py index d5f858b0866..4fef6a6bf8f 100644 --- a/qa/tasks/cephfs/test_cephfs_shell.py +++ b/qa/tasks/cephfs/test_cephfs_shell.py @@ -588,6 +588,29 @@ class TestDU(TestCephFSShell): # log.info('ls -a failed') class TestMisc(TestCephFSShell): + def test_issue_cephfs_shell_cmd_at_invocation(self): + """ + Test that `cephfs-shell -c conf cmd` works. + """ + # choosing a long name since short ones have a higher probability + # of getting matched by coincidence. + dirname = 'somedirectory' + self.run_cephfs_shell_cmd(['mkdir', dirname]) + + # TODO: Once cephfs-shell can pickup its config variables from + # ceph.conf, set colors Never there and get rid of the same in + # following comamnd. + output = self.mount_a.client_remote.run(args=['cephfs-shell', '-c', + self.mount_a.config_path, 'set colors Never, ls'], + stdout=StringIO()).stdout.getvalue().strip() + + if sys_version_info.major >= 3: + self.assertRegex(dirname, output) + elif sys_version_info.major < 3: + assert re_search(dirname, output) != None, "\n" + \ + "expected_output -\n{}\ndu_output -\n{}\n".format( + dirname, output) + def test_help(self): """ Test that help outputs commands. -- 2.39.5