mirror of
https://github.com/ceph/ceph
synced 2024-12-29 23:12:27 +00:00
Merge PR #49934 into main
* refs/pull/49934/head: qa: add test_fscrypt_dummy_encryption test case support qa: add 'options' parameter support for write_local_config qa: add ceph.exclude file to exclude individual tests qa: add require_kernel_mount helper support qa: rename test_fscrypt to test_fscrypt_encrypt Reviewed-by: Dhairya Parmar <dparmar@redhat.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
This commit is contained in:
commit
86b90286cd
@ -12,7 +12,7 @@ class TestFscrypt(XFSTestsDev):
|
||||
def setup_xfsprogs_devs(self):
|
||||
self.install_xfsprogs = True
|
||||
|
||||
def test_fscrypt(self):
|
||||
def require_kernel_mount(self):
|
||||
from tasks.cephfs.fuse_mount import FuseMount
|
||||
from tasks.cephfs.kernel_mount import KernelMount
|
||||
|
||||
@ -20,19 +20,21 @@ class TestFscrypt(XFSTestsDev):
|
||||
# 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')
|
||||
|
||||
def test_fscrypt_encrypt(self):
|
||||
self.require_kernel_mount()
|
||||
|
||||
# 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,
|
||||
stderr=StringIO(), timeout=900, check_status=False, omit_sudo=False,
|
||||
label='running tests for encrypt from xfstests-dev')
|
||||
|
||||
if proc.returncode != 0:
|
||||
@ -47,3 +49,29 @@ class TestFscrypt(XFSTestsDev):
|
||||
# skipped for now because of not supporting features in kernel or kceph.
|
||||
self.assertEqual(proc.returncode, 0)
|
||||
self.assertIn('Passed all 26 tests', stdout)
|
||||
|
||||
def test_fscrypt_dummy_encryption_with_quick_group(self):
|
||||
self.require_kernel_mount()
|
||||
|
||||
self.write_local_config('test_dummy_encryption')
|
||||
|
||||
# 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. This will take a long time and set the timeout to 3 hours.
|
||||
proc = self.mount_a.client_remote.run(args=['sudo', './check',
|
||||
'-g', 'quick', '-E', './ceph.exclude'], cwd=self.xfstests_repo_path,
|
||||
stdout=StringIO(), stderr=StringIO(), timeout=10800, check_status=False,
|
||||
omit_sudo=False, label='running tests for dummy_encryption 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, many test cases will be skipped due to unsupported features,
|
||||
# but still will be marked as successful.
|
||||
self.assertEqual(proc.returncode, 0)
|
||||
self.assertIn('Passed all ', stdout)
|
||||
|
@ -1,5 +1,8 @@
|
||||
from io import StringIO
|
||||
from logging import getLogger
|
||||
from os.path import join
|
||||
from textwrap import dedent
|
||||
|
||||
|
||||
from tasks.cephfs.cephfs_test_case import CephFSTestCase
|
||||
|
||||
@ -29,6 +32,7 @@ class XFSTestsDev(CephFSTestCase):
|
||||
self.install_deps()
|
||||
self.create_reqd_users()
|
||||
self.write_local_config()
|
||||
self.write_ceph_exclude()
|
||||
|
||||
# NOTE: On teuthology machines it's necessary to run "make" as
|
||||
# superuser since the repo is cloned somewhere in /tmp.
|
||||
@ -82,7 +86,6 @@ class XFSTestsDev(CephFSTestCase):
|
||||
and "scratch" directories would be mounted. Look at xfstests-dev
|
||||
local.config's template inside this file to get some context.
|
||||
"""
|
||||
from os.path import join
|
||||
|
||||
self.test_dirname = 'test'
|
||||
self.mount_a.run_shell(['mkdir', self.test_dirname])
|
||||
@ -160,9 +163,8 @@ class XFSTestsDev(CephFSTestCase):
|
||||
'123456-fsgqa'], omit_sudo=False,
|
||||
check_status=False)
|
||||
|
||||
def write_local_config(self):
|
||||
from os.path import join
|
||||
from textwrap import dedent
|
||||
def write_local_config(self, options=None):
|
||||
_options = '' if not options else ',' + options
|
||||
|
||||
mon_sock = self.fs.mon_manager.get_msgrv1_mon_socks()[0]
|
||||
self.test_dev = mon_sock + ':/' + self.test_dirname
|
||||
@ -174,13 +176,23 @@ class XFSTestsDev(CephFSTestCase):
|
||||
export TEST_DIR={}
|
||||
export SCRATCH_DEV={}
|
||||
export SCRATCH_MNT={}
|
||||
export CEPHFS_MOUNT_OPTIONS="-o name=admin,secret={}"
|
||||
export CEPHFS_MOUNT_OPTIONS="-o name=admin,secret={}{}"
|
||||
''').format(self.test_dev, self.test_dirs_mount_path, self.scratch_dev,
|
||||
self.scratch_dirs_mount_path, self.get_admin_key())
|
||||
self.scratch_dirs_mount_path, self.get_admin_key(), _options)
|
||||
|
||||
self.mount_a.client_remote.write_file(join(self.xfstests_repo_path, 'local.config'),
|
||||
xfstests_config_contents, sudo=True)
|
||||
|
||||
def write_ceph_exclude(self):
|
||||
# These tests will fail or take too much time and will
|
||||
# make the test timedout, just skip them for now.
|
||||
xfstests_exclude_contents = dedent('''\
|
||||
{c}/001 {g}/003 {g}/020 {g}/075 {g}/317 {g}/538 {g}/531
|
||||
''').format(g="generic", c="ceph")
|
||||
|
||||
self.mount_a.client_remote.write_file(join(self.xfstests_repo_path, 'ceph.exclude'),
|
||||
xfstests_exclude_contents, sudo=True)
|
||||
|
||||
def tearDown(self):
|
||||
self.mount_a.client_remote.run(args=['sudo', 'userdel', '--force',
|
||||
'--remove', 'fsgqa'],
|
||||
|
Loading…
Reference in New Issue
Block a user