ceph/qa/tasks/cephfs/test_cephfs_shell.py
Patrick Donnelly 0b5df6e00a
qa: add cephfs-shell skeleton test case
Right now just tests that "help" works.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2018-08-16 09:13:36 -07:00

36 lines
1.1 KiB
Python

import logging
from StringIO import StringIO
from tasks.cephfs.cephfs_test_case import CephFSTestCase
from tasks.cephfs.fuse_mount import FuseMount
from teuthology.exceptions import CommandFailedError
log = logging.getLogger(__name__)
class TestCephFSShell(CephFSTestCase):
CLIENTS_REQUIRED = 1
py_version = 'python'
def setUp(self):
CephFSTestCase.setUp(self)
self.py_version = self.ctx.config.get('overrides', {}).get('python', 'python')
log.info("using python version: {}".format(self.py_version))
def _cephfs_shell(self, cmd, opts=None):
args = ["cephfs-shell", "-c", self.mount_a.config_path]
if opts is not None:
args.extend(opts)
args.extend(("--", cmd))
log.info("Running command: {}".format(" ".join(args)))
status = self.mount_a.client_remote.run(args=args, stdout=StringIO())
return status.stdout.getvalue().strip()
def test_help(self):
"""
Test that help outputs commands.
"""
o = self._cephfs_shell("help")
log.info("output:\n{}".format(o))