]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: add xfstests fscrypt test cases support
authorXiubo Li <xiubli@redhat.com>
Wed, 26 Oct 2022 06:48:02 +0000 (14:48 +0800)
committerXiubo Li <xiubli@redhat.com>
Thu, 1 Dec 2022 08:33:10 +0000 (16:33 +0800)
This will test the common fscrypt features such as the set_encpolicy,
get_encpolicy,etc only.

Will run the IO path test in another test suite.

Fixes: https://tracker.ceph.com/issues/58133
Signed-off-by: Xiubo Li <xiubli@redhat.com>
qa/tasks/cephfs/test_fscrypt.py [new file with mode: 0644]

diff --git a/qa/tasks/cephfs/test_fscrypt.py b/qa/tasks/cephfs/test_fscrypt.py
new file mode 100644 (file)
index 0000000..406eae5
--- /dev/null
@@ -0,0 +1,49 @@
+from logging import getLogger
+
+from io import StringIO
+from tasks.cephfs.xfstests_dev import XFSTestsDev
+
+
+log = getLogger(__name__)
+
+
+class TestFscrypt(XFSTestsDev):
+
+    def setup_xfsprogs_devs(self):
+        self.install_xfsprogs = True
+
+    def test_fscrypt(self):
+        from tasks.cephfs.fuse_mount import FuseMount
+        from tasks.cephfs.kernel_mount import KernelMount
+
+        # TODO: make xfstests-dev compatible with ceph-fuse. xfstests-dev
+        # remounts CephFS before running tests using kernel, so ceph-fuse
+        # mounts are never actually tested.
+        if isinstance(self.mount_a, FuseMount):
+            log.info('client is fuse mounted')
+            self.skipTest('Requires kernel client; xfstests-dev not '\
+                          'compatible with ceph-fuse ATM.')
+        elif isinstance(self.mount_a, KernelMount):
+            log.info('client is kernel mounted')
+
+        # XXX: check_status is set to False so that we can check for command's
+        # failure on our own (since this command doesn't set right error code
+        # and error message in some cases) and print custom log messages
+        # accordingly.
+        proc = self.mount_a.client_remote.run(args=['sudo', './check',
+            '-g', 'encrypt'], cwd=self.xfstests_repo_path, stdout=StringIO(),
+            stderr=StringIO(), timeout=900, check_status=False,omit_sudo=False,
+            label='running tests for encrypt from xfstests-dev')
+
+        if proc.returncode != 0:
+            log.info('Command failed.')
+        log.info(f'Command return value: {proc.returncode}')
+        stdout, stderr = proc.stdout.getvalue(), proc.stderr.getvalue()
+        log.info(f'Command stdout -\n{stdout}')
+        log.info(f'Command stderr -\n{stderr}')
+
+        # Currently only the 395,396,397,421,429,435,440,580,593,595 and 598
+        # of the 26 test cases will be actually ran, all the others will be
+        # skipped for now because of not supporting features in kernel or kceph.
+        self.assertEqual(proc.returncode, 0)
+        self.assertIn('Passed all 26 tests', stdout)