Skip to content

Commit

Permalink
test: selftest for ceph.dir.bal.mask vxattr
Browse files Browse the repository at this point in the history
Signed-off-by: Yongseok Oh <yongseok.oh@linecorp.com>
  • Loading branch information
yongseokoh committed Sep 18, 2023
1 parent f6018a7 commit 53a786c
Show file tree
Hide file tree
Showing 2 changed files with 372 additions and 4 deletions.
11 changes: 7 additions & 4 deletions qa/tasks/cephfs/cephfs_test_case.py
Expand Up @@ -328,7 +328,7 @@ def delete_mds_coredump(self, daemon_id):
else:
log.info("No core_pattern directory set, nothing to clear (internal.coredump not enabled?)")

def _get_subtrees(self, status=None, rank=None, path=None):
def _get_subtrees(self, status=None, rank=None, path=None, exclude_path=None):
if path is None:
path = "/"
try:
Expand All @@ -344,6 +344,8 @@ def _get_subtrees(self, status=None, rank=None, path=None):
else:
subtrees = self.fs.rank_asok(["get", "subtrees"], status=status, rank=rank)
subtrees = filter(lambda s: s['dir']['path'].startswith(path), subtrees)
if exclude_path:
subtrees = filter(lambda s: not s['dir']['path'].startswith(exclude_path), subtrees)
return list(subtrees)
except CommandFailedError as e:
# Sometimes we get transient errors
Expand All @@ -354,14 +356,15 @@ def _get_subtrees(self, status=None, rank=None, path=None):
except contextutil.MaxWhileTries as e:
raise RuntimeError(f"could not get subtree state from rank {rank}") from e

def _wait_subtrees(self, test, status=None, rank=None, timeout=30, sleep=2, action=None, path=None):
def _wait_subtrees(self, test, status=None, rank=None, timeout=30, sleep=2, action=None, path=None, exclude_path=None):
log.info(f'_wait_subtrees {test} {rank} {path}')
test = sorted(test)
try:
with contextutil.safe_while(sleep=sleep, tries=timeout//sleep) as proceed:
while proceed():
subtrees = self._get_subtrees(status=status, rank=rank, path=path)
subtrees = self._get_subtrees(status=status, rank=rank, path=path, exclude_path=exclude_path)
log.info(subtrees)
filtered = sorted([(s['dir']['path'], s['auth_first']) for s in subtrees])
log.info("%s =?= %s", filtered, test)
if filtered == test:
# Confirm export_pin in output is correct:
for s in subtrees:
Expand Down

0 comments on commit 53a786c

Please sign in to comment.