From 7fb3308498a96088116829ff4daefe76e68adddd Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 9 Sep 2008 17:57:06 -0700 Subject: [PATCH] mutable checker: even more tests. Everything in ICheckerResults should be covered now, except for immutable-verify which is incomplete --- src/allmydata/mutable/checker.py | 9 ++++++++- src/allmydata/test/test_system.py | 18 ++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/allmydata/mutable/checker.py b/src/allmydata/mutable/checker.py index 58da3cfd..c4670083 100644 --- a/src/allmydata/mutable/checker.py +++ b/src/allmydata/mutable/checker.py @@ -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] diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 20e07669..df400a09 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -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") -- 2.45.2