From 475babd9eed21a4a1beef975dfd7fa0fb00fa511 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Wed, 26 Jul 2023 20:46:55 -0400 Subject: [PATCH] qa: add test cases for vanilla ops commands To test they work, not that the output is useful. Signed-off-by: Patrick Donnelly (cherry picked from commit ca4d0dc42b553352d64c0eb9a8be6487b59b03fe) Conflicts: qa/tasks/cephfs/test_admin.py: dump_blocked_ops_count does not exist in quincy, introduced in 1ead2229aeb1f2cca0f4f4f328cb176443389760 --- qa/tasks/cephfs/cephfs_test_case.py | 6 ++++++ qa/tasks/cephfs/test_admin.py | 29 ++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/qa/tasks/cephfs/cephfs_test_case.py b/qa/tasks/cephfs/cephfs_test_case.py index 129b84790e903..d2688929cc37f 100644 --- a/qa/tasks/cephfs/cephfs_test_case.py +++ b/qa/tasks/cephfs/cephfs_test_case.py @@ -13,6 +13,12 @@ from teuthology.exceptions import CommandFailedError log = logging.getLogger(__name__) +def classhook(m): + def dec(cls): + getattr(cls, m)() + return cls + return dec + def for_teuthology(f): """ Decorator that adds an "is_for_teuthology" attribute to the wrapped function diff --git a/qa/tasks/cephfs/test_admin.py b/qa/tasks/cephfs/test_admin.py index ff6cd761e3ca6..baf9873b49751 100644 --- a/qa/tasks/cephfs/test_admin.py +++ b/qa/tasks/cephfs/test_admin.py @@ -9,7 +9,7 @@ from os.path import join as os_path_join from teuthology.orchestra.run import Raw from teuthology.exceptions import CommandFailedError -from tasks.cephfs.cephfs_test_case import CephFSTestCase +from tasks.cephfs.cephfs_test_case import CephFSTestCase, classhook from tasks.cephfs.filesystem import FileLayout, FSMissing from tasks.cephfs.fuse_mount import FuseMount from tasks.cephfs.caps_helper import CapsHelper @@ -38,6 +38,33 @@ class TestAdminCommands(CephFSTestCase): if overwrites: self.fs.mon_manager.raw_cluster_cmd('osd', 'pool', 'set', n+"-data", 'allow_ec_overwrites', 'true') +@classhook('_add_valid_tell') +class TestValidTell(TestAdminCommands): + @classmethod + def _add_valid_tell(cls): + tells = [ + ['cache', 'status'], + ['damage', 'ls'], + ['dump_blocked_ops'], + ['dump_historic_ops'], + ['dump_historic_ops_by_duration'], + ['dump_mempools'], + ['dump_ops_in_flight'], + ['flush', 'journal'], + ['get', 'subtrees'], + ['ops', 'locks'], + ['ops'], + ['status'], + ['version'], + ] + def test(c): + def f(self): + J = self.fs.rank_tell(c) + json.dumps(J) + log.debug("dumped:\n%s", str(J)) + return f + for c in tells: + setattr(cls, 'test_valid_' + '_'.join(c), test(c)) class TestFsStatus(TestAdminCommands): """ -- 2.39.5