From 70f22f69b59bcd67c684cdb09ed01a605372b4d7 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Tue, 16 Jul 2019 15:47:18 +0530 Subject: [PATCH] test_cephfs_shell: group test methods Move tests into different classes created on the basis of a shell functionality within the testsuite. This arrangement allows running tests related to only one functionality at a time. Signed-off-by: Rishabh Dave --- qa/tasks/cephfs/test_cephfs_shell.py | 47 +++++++++++++++------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/qa/tasks/cephfs/test_cephfs_shell.py b/qa/tasks/cephfs/test_cephfs_shell.py index 8f3d7c398c7..86810fc295d 100644 --- a/qa/tasks/cephfs/test_cephfs_shell.py +++ b/qa/tasks/cephfs/test_cephfs_shell.py @@ -44,15 +44,7 @@ class TestCephFSShell(CephFSTestCase): return mount_x.client_remote.run(args=args, stdout=StringIO(), stderr=StringIO(), stdin=stdin) - def test_help(self): - """ - Test that help outputs commands. - """ - - o = self._cephfs_shell("help") - - log.info("output:\n{}".format(o)) - +class TestMkdir(TestCephFSShell): def test_mkdir(self): """ Test that mkdir creates directory @@ -141,18 +133,8 @@ class TestCephFSShell(CephFSTestCase): o = self.mount_a.stat('d5/d6/d7') log.info("mount_a output:\n{}".format(o)) - def validate_stat_output(self, s): - l = s.split('\n') - log.info("lines:\n{}".format(l)) - rv = l[-1] # get last line; a failed stat will have "1" as the line - log.info("rv:{}".format(rv)) - r = 0 - try: - r = int(rv) # a non-numeric line will cause an exception - except: - pass - assert(r == 0) - +class TestGetAndPut(TestCephFSShell): + # the 'put' command gets tested as well with the 'get' comamnd def test_put_and_get_without_target_directory(self): """ Test that put fails without target path @@ -195,7 +177,18 @@ class TestCephFSShell(CephFSTestCase): log.info("cephfs-shell output:\n{}".format(o)) self.validate_stat_output(o) - # the 'put' command gets tested as well with the 'get' comamnd + def validate_stat_output(self, s): + l = s.split('\n') + log.info("lines:\n{}".format(l)) + rv = l[-1] # get last line; a failed stat will have "1" as the line + log.info("rv:{}".format(rv)) + r = 0 + try: + r = int(rv) # a non-numeric line will cause an exception + except: + pass + assert(r == 0) + def test_get_with_target_name(self): """ Test that get passes with target name @@ -301,3 +294,13 @@ class TestCephFSShell(CephFSTestCase): # log.info('ls -a succeeded') # else: # log.info('ls -a failed') + +class TestMisc(TestCephFSShell): + def test_help(self): + """ + Test that help outputs commands. + """ + + o = self._cephfs_shell("help") + + log.info("output:\n{}".format(o)) -- 2.39.5