]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test_cephfs_shell: test cephfs-shell command at invocation
authorRishabh Dave <ridave@redhat.com>
Thu, 1 Aug 2019 20:22:22 +0000 (01:52 +0530)
committerRishabh Dave <ridave@redhat.com>
Fri, 13 Sep 2019 05:15:42 +0000 (10:45 +0530)
Verify that "cephfs-shell -c ceph.conf <cephfs-shell-cmd>" works as
expected.

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

index d5f858b086610c36eaf7c89c9706ee2e859e1dff..4fef6a6bf8fc01dc3206645f37066f57742d5ebd 100644 (file)
@@ -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.