Skip to content

Commit

Permalink
qa/cephfs: add bal_rank_mask test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Yongseok Oh <[email protected]>
  • Loading branch information
yongseokoh committed Oct 13, 2022
1 parent e134c89 commit 10fb8f1
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qa/tasks/cephfs/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,9 @@ def set_allow_standby_replay(self, yes):
def set_allow_new_snaps(self, yes):
self.set_var("allow_new_snaps", yes, '--yes-i-really-mean-it')

def set_bal_rank_mask(self, bal_rank_mask):
self.set_var("bal_rank_mask", bal_rank_mask)

def compat(self, *args):
a = map(lambda x: str(x).lower(), args)
self.mon_manager.raw_cluster_cmd("fs", "compat", self.name, *a)
Expand Down
77 changes: 77 additions & 0 deletions qa/tasks/cephfs/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,3 +1387,80 @@ def test_dump_loads(self):
self.assertIn("dirfrags", loads)
for d in loads["dirfrags"]:
self.assertLessEqual(d["path"].count("/"), 1)

class TestFsBalRankMask(CephFSTestCase):
"""
Tests ceph fs set <fs_name> bal_rank_mask
"""

CLIENTS_REQUIRED = 0
MDSS_REQUIRED = 2

def test_bal_rank_mask(self):
"""
check whether a specified bal_rank_mask value is valid or not.
"""
bal_rank_mask = '0x0'
log.info(f"set bal_rank_mask {bal_rank_mask}")
self.fs.set_bal_rank_mask(bal_rank_mask)
self.assertEqual(bal_rank_mask, self.fs.get_var('bal_rank_mask'))

bal_rank_mask = '0'
log.info(f"set bal_rank_mask {bal_rank_mask}")
self.fs.set_bal_rank_mask(bal_rank_mask)
self.assertEqual(bal_rank_mask, self.fs.get_var('bal_rank_mask'))

bal_rank_mask = '-1'
log.info(f"set bal_rank_mask {bal_rank_mask}")
self.fs.set_bal_rank_mask(bal_rank_mask)
self.assertEqual(bal_rank_mask, self.fs.get_var('bal_rank_mask'))

bal_rank_mask = 'all'
log.info(f"set bal_rank_mask {bal_rank_mask}")
self.fs.set_bal_rank_mask(bal_rank_mask)
self.assertEqual(bal_rank_mask, self.fs.get_var('bal_rank_mask'))

bal_rank_mask = '0x1'
log.info(f"set bal_rank_mask {bal_rank_mask}")
self.fs.set_bal_rank_mask(bal_rank_mask)
self.assertEqual(bal_rank_mask, self.fs.get_var('bal_rank_mask'))

bal_rank_mask = '1'
log.info(f"set bal_rank_mask {bal_rank_mask}")
self.fs.set_bal_rank_mask(bal_rank_mask)
self.assertEqual(bal_rank_mask, self.fs.get_var('bal_rank_mask'))

bal_rank_mask = 'f0'
log.info(f"set bal_rank_mask {bal_rank_mask}")
self.fs.set_bal_rank_mask(bal_rank_mask)
self.assertEqual(bal_rank_mask, self.fs.get_var('bal_rank_mask'))

bal_rank_mask = 'ab'
log.info(f"set bal_rank_mask {bal_rank_mask}")
self.fs.set_bal_rank_mask(bal_rank_mask)
self.assertEqual(bal_rank_mask, self.fs.get_var('bal_rank_mask'))

bal_rank_mask = '0xfff0'
log.info(f"set bal_rank_mask {bal_rank_mask}")
self.fs.set_bal_rank_mask(bal_rank_mask)
self.assertEqual(bal_rank_mask, self.fs.get_var('bal_rank_mask'))

MAX_MDS = 256
bal_rank_mask = '0x' + 'f' * int(MAX_MDS / 4)
log.info(f"set bal_rank_mask {bal_rank_mask}")
self.fs.set_bal_rank_mask(bal_rank_mask)
self.assertEqual(bal_rank_mask, self.fs.get_var('bal_rank_mask'))

bal_rank_mask = ''
log.info("set bal_rank_mask to empty string")
try:
self.fs.set_bal_rank_mask(bal_rank_mask)
except CommandFailedError as e:
self.assertEqual(e.exitstatus, errno.EINVAL)

bal_rank_mask = '0x1' + 'f' * int(MAX_MDS / 4)
log.info(f"set bal_rank_mask {bal_rank_mask}")
try:
self.fs.set_bal_rank_mask(bal_rank_mask)
except CommandFailedError as e:
self.assertEqual(e.exitstatus, errno.EINVAL)
1 change: 1 addition & 0 deletions qa/tasks/mgr/dashboard/test_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class HealthTest(DashboardTestCase):
__mdsmap_schema = JObj({
'session_autoclose': int,
'balancer': str,
'bal_rank_mask': str,
'up': JObj({}, allow_unknown=True),
'last_failure_osd_epoch': int,
'in': JList(int),
Expand Down

0 comments on commit 10fb8f1

Please sign in to comment.