mirror of
https://github.com/ceph/ceph
synced 2025-04-16 20:32:41 +00:00
test: subclass test_scrub.Workload from CephFSTestCase
This allows usage of assert*() calls instead of writing our own version. Signed-off-by: Venky Shankar <vshankar@redhat.com>
This commit is contained in:
parent
a70d21b162
commit
ba23f5aa70
@ -14,7 +14,7 @@ log = logging.getLogger(__name__)
|
||||
ValidationError = namedtuple("ValidationError", ["exception", "backtrace"])
|
||||
|
||||
|
||||
class Workload(object):
|
||||
class Workload(CephFSTestCase):
|
||||
def __init__(self, filesystem, mount):
|
||||
self._mount = mount
|
||||
self._filesystem = filesystem
|
||||
@ -26,15 +26,6 @@ class Workload(object):
|
||||
# a string
|
||||
self._errors = []
|
||||
|
||||
def assert_equal(self, a, b):
|
||||
try:
|
||||
if a != b:
|
||||
raise AssertionError("{0} != {1}".format(a, b))
|
||||
except AssertionError as e:
|
||||
self._errors.append(
|
||||
ValidationError(e, traceback.format_exc(3))
|
||||
)
|
||||
|
||||
def write(self):
|
||||
"""
|
||||
Write the workload files to the mount
|
||||
@ -78,7 +69,7 @@ class BacktraceWorkload(Workload):
|
||||
self._filesystem.mds_asok(["flush", "journal"])
|
||||
bt = self._filesystem.read_backtrace(st['st_ino'])
|
||||
parent = bt['ancestors'][0]['dname']
|
||||
self.assert_equal(parent, "sixmegs")
|
||||
self.assertEqual(parent, 'sixmegs')
|
||||
return self._errors
|
||||
|
||||
def damage(self):
|
||||
@ -113,7 +104,7 @@ class DupInodeWorkload(Workload):
|
||||
|
||||
def validate(self):
|
||||
self._filesystem.mds_asok(["scrub_path", "/", "recursive", "repair"])
|
||||
self.assert_equal(self._filesystem.are_daemons_healthy(), True)
|
||||
self.assertTrue(self._filesystem.are_daemons_healthy())
|
||||
return self._errors
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user