From ba23f5aa707b306f35939325b48de79859c93bcc Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Tue, 17 Jul 2018 02:06:44 -0400 Subject: [PATCH] test: subclass test_scrub.Workload from CephFSTestCase This allows usage of assert*() calls instead of writing our own version. Signed-off-by: Venky Shankar --- qa/tasks/cephfs/test_scrub.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/qa/tasks/cephfs/test_scrub.py b/qa/tasks/cephfs/test_scrub.py index 32371dd67be94..12ce1668ed1bf 100644 --- a/qa/tasks/cephfs/test_scrub.py +++ b/qa/tasks/cephfs/test_scrub.py @@ -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 -- 2.39.5