mutable checker: even more tests. Everything in ICheckerResults should be covered now, except for immutable-verify which is incomplete

This commit is contained in:
Brian Warner 2008-09-09 17:57:06 -07:00
parent 84a5778507
commit 7fb3308498
2 changed files with 18 additions and 9 deletions

View 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]

View 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")