]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: subclass test_scrub.Workload from CephFSTestCase
authorVenky Shankar <vshankar@redhat.com>
Tue, 17 Jul 2018 06:06:44 +0000 (02:06 -0400)
committerPrashant D <pdhange@redhat.com>
Wed, 25 Jul 2018 06:43:19 +0000 (02:43 -0400)
This allows usage of assert*() calls instead of writing
our own version.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit ba23f5aa707b306f35939325b48de79859c93bcc)

qa/tasks/cephfs/test_scrub.py

index 32371dd67be94218d52b574db1f5685fbff958a7..12ce1668ed1bfd362f56a19415d12538063a26e6 100644 (file)
@@ -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