test_cephfs_shell: test cephfs-shell command at invocation

Verify that "cephfs-shell -c ceph.conf <cephfs-shell-cmd>" works as
expected.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
This commit is contained in:
Rishabh Dave 2019-08-02 01:52:22 +05:30
parent 7f90c50704
commit f9b4d790e5

View 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.