From 0b5df6e00a7b1b290f20714c044bef910c5224d8 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Wed, 15 Aug 2018 12:33:33 -0700 Subject: [PATCH] qa: add cephfs-shell skeleton test case Right now just tests that "help" works. Signed-off-by: Patrick Donnelly --- qa/cephfs/begin.yaml | 3 +- .../fs/basic_functional/tasks/cephfs-shell/+ | 0 .../tasks/cephfs-shell/py-3.yaml | 2 ++ .../tasks/cephfs-shell/test.yaml | 15 ++++++++ qa/tasks/cephfs/test_cephfs_shell.py | 35 +++++++++++++++++++ 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 qa/suites/fs/basic_functional/tasks/cephfs-shell/+ create mode 100644 qa/suites/fs/basic_functional/tasks/cephfs-shell/py-3.yaml create mode 100644 qa/suites/fs/basic_functional/tasks/cephfs-shell/test.yaml create mode 100644 qa/tasks/cephfs/test_cephfs_shell.py diff --git a/qa/cephfs/begin.yaml b/qa/cephfs/begin.yaml index 9829253795a5e..58099a3a4dd39 100644 --- a/qa/cephfs/begin.yaml +++ b/qa/cephfs/begin.yaml @@ -1,5 +1,6 @@ tasks: - install: extra_packages: - - python3-cephfs + rpm: ['python3-cephfs'] + deb: ['python3-cephfs', 'cephfs-shell'] - ceph: diff --git a/qa/suites/fs/basic_functional/tasks/cephfs-shell/+ b/qa/suites/fs/basic_functional/tasks/cephfs-shell/+ new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/qa/suites/fs/basic_functional/tasks/cephfs-shell/py-3.yaml b/qa/suites/fs/basic_functional/tasks/cephfs-shell/py-3.yaml new file mode 100644 index 0000000000000..9bd4a922626c3 --- /dev/null +++ b/qa/suites/fs/basic_functional/tasks/cephfs-shell/py-3.yaml @@ -0,0 +1,2 @@ +overrides: + python: python3 diff --git a/qa/suites/fs/basic_functional/tasks/cephfs-shell/test.yaml b/qa/suites/fs/basic_functional/tasks/cephfs-shell/test.yaml new file mode 100644 index 0000000000000..b4f0d4ab057c0 --- /dev/null +++ b/qa/suites/fs/basic_functional/tasks/cephfs-shell/test.yaml @@ -0,0 +1,15 @@ +# Right now, cephfs-shell is only available as a package on Ubuntu +# This overrides the random distribution that's chosen in the other yaml fragments. +os_type: ubuntu +os_version: "18.04" + +overrides: + ceph: + conf: + global: + ms type: simple + +tasks: + - cephfs_test_runner: + modules: + - tasks.cephfs.test_cephfs_shell diff --git a/qa/tasks/cephfs/test_cephfs_shell.py b/qa/tasks/cephfs/test_cephfs_shell.py new file mode 100644 index 0000000000000..0aad5dd4ca907 --- /dev/null +++ b/qa/tasks/cephfs/test_cephfs_shell.py @@ -0,0 +1,35 @@ +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)) -- 2.39.5