]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
mutable checker: even more tests. Everything in ICheckerResults should be covered...
authorBrian Warner <warner@allmydata.com>
Wed, 10 Sep 2008 00:57:06 +0000 (17:57 -0700)
committerBrian Warner <warner@allmydata.com>
Wed, 10 Sep 2008 00:57:06 +0000 (17:57 -0700)
src/allmydata/mutable/checker.py
src/allmydata/test/test_system.py

index 58da3cfde714b5bfb4b2803d2b82a6620fced052..c4670083cf40975c3f2f3eaf0d8c3ae71f6e945f 100644 (file)
@@ -244,7 +244,14 @@ class MutableChecker:
             data["count-corrupt-shares"] = 0
             data["list-corrupt-shares"] = []
 
-        # TODO: sharemap
+        sharemap = {}
+        for verinfo in vmap:
+            for (shnum, peerid, timestamp) in vmap[verinfo]:
+                shareid = "%s-sh%d" % (smap.summarize_version(verinfo), shnum)
+                if shareid not in sharemap:
+                    sharemap[shareid] = []
+                sharemap[shareid].append(base32.b2a(peerid))
+        data["sharemap"] = sharemap
         data["servers-responding"] = [base32.b2a(serverid)
                                       for serverid in smap.reachable_peers]
 
index 20e076695c9e562b36feb1000fae2160c9dd7bc5..df400a09f81dc42165f4e69bc6a2bb729fdec398 100644 (file)
@@ -2042,16 +2042,18 @@ class DeepCheck(SystemTestMixin, unittest.TestCase):
         self.failUnlessEqual(sorted(d["servers-responding"]),
                              sorted([idlib.nodeid_b2a(c.nodeid)
                                      for c in self.clients]), where)
-        #self.failUnless("sharemap" in d)
+        self.failUnless("sharemap" in d, where)
         self.failUnlessEqual(d["count-wrong-shares"], 0, where)
         self.failUnlessEqual(d["count-recoverable-versions"], 1, where)
         self.failUnlessEqual(d["count-unrecoverable-versions"], 0, where)
 
 
-    def check_and_repair_is_healthy(self, cr, where):
+    def check_and_repair_is_healthy(self, cr, n, where):
         self.failUnless(ICheckAndRepairResults.providedBy(cr), where)
         self.failUnless(cr.get_pre_repair_results().is_healthy(), where)
+        #self.check_is_healthy(cr.get_pre_repair_results(), n, where)
         self.failUnless(cr.get_post_repair_results().is_healthy(), where)
+        #self.check_is_healthy(cr.get_post_repair_results(), n, where)
         self.failIf(cr.get_repair_attempted(), where)
 
     def deep_check_is_healthy(self, cr, num_healthy, where):
@@ -2099,21 +2101,21 @@ class DeepCheck(SystemTestMixin, unittest.TestCase):
 
         # and check_and_repair(), which should be a nop
         d.addCallback(lambda ign: self.root.check_and_repair())
-        d.addCallback(self.check_and_repair_is_healthy, "root")
+        d.addCallback(self.check_and_repair_is_healthy, self.root, "root")
         d.addCallback(lambda ign: self.mutable.check_and_repair())
-        d.addCallback(self.check_and_repair_is_healthy, "mutable")
+        d.addCallback(self.check_and_repair_is_healthy, self.mutable, "mutable")
         d.addCallback(lambda ign: self.large.check_and_repair())
-        d.addCallback(self.check_and_repair_is_healthy, "large")
+        d.addCallback(self.check_and_repair_is_healthy, self.large, "large")
         d.addCallback(lambda ign: self.small.check_and_repair())
         d.addCallback(self.failUnlessEqual, None, "small")
 
         # check_and_repair(verify=True)
         d.addCallback(lambda ign: self.root.check_and_repair(verify=True))
-        d.addCallback(self.check_and_repair_is_healthy, "root")
+        d.addCallback(self.check_and_repair_is_healthy, self.root, "root")
         d.addCallback(lambda ign: self.mutable.check_and_repair(verify=True))
-        d.addCallback(self.check_and_repair_is_healthy, "mutable")
+        d.addCallback(self.check_and_repair_is_healthy, self.mutable, "mutable")
         d.addCallback(lambda ign: self.large.check_and_repair(verify=True))
-        d.addCallback(self.check_and_repair_is_healthy, "large")
+        d.addCallback(self.check_and_repair_is_healthy, self.large, "large")
         d.addCallback(lambda ign: self.small.check_and_repair(verify=True))
         d.addCallback(self.failUnlessEqual, None, "small")