2021-12-05 19:06:12 +00:00
|
|
|
from logging import getLogger
|
2019-08-08 15:52:58 +00:00
|
|
|
|
2022-04-19 09:24:31 +00:00
|
|
|
from io import StringIO
|
2020-03-24 08:33:22 +00:00
|
|
|
from tasks.cephfs.xfstests_dev import XFSTestsDev
|
2019-08-08 15:52:58 +00:00
|
|
|
|
2022-04-18 16:29:02 +00:00
|
|
|
|
2021-12-05 19:06:12 +00:00
|
|
|
log = getLogger(__name__)
|
2019-08-08 15:52:58 +00:00
|
|
|
|
2022-04-18 16:29:02 +00:00
|
|
|
|
2019-08-08 15:52:58 +00:00
|
|
|
class TestACLs(XFSTestsDev):
|
|
|
|
|
|
|
|
def test_acls(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 testsed.
|
|
|
|
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')
|
|
|
|
|
2022-04-18 16:29:02 +00:00
|
|
|
# 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.
|
2023-02-21 05:20:50 +00:00
|
|
|
proc = self.mount_a.client_remote.run(args=['sudo', 'env', 'DIFF_LENGTH=0',
|
|
|
|
'./check', 'generic/099'], cwd=self.xfstests_repo_path, stdout=StringIO(),
|
2022-04-18 16:29:02 +00:00
|
|
|
stderr=StringIO(), timeout=30, check_status=False,omit_sudo=False,
|
2019-08-08 15:52:58 +00:00
|
|
|
label='running tests for ACLs from xfstests-dev')
|
2022-04-18 16:29:02 +00:00
|
|
|
|
|
|
|
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}')
|
2022-04-18 19:21:04 +00:00
|
|
|
|
|
|
|
self.assertEqual(proc.returncode, 0)
|
|
|
|
success_line = 'Passed all 1 tests'
|
|
|
|
self.assertIn(success_line, stdout)
|