immutable: tests: put shares back to their pristine condition in between each test of corrupting-and-repairing them

This is important, because if the repairer doesn't completely repair all kinds of corruption (as the current one doesn't), then the successive tests get messed up by assuming that the shares were uncorrupted when the test first set about to corrupt them.
This commit is contained in:
Zooko O'Whielacronx 2009-02-09 18:29:56 -07:00
parent a9a3b509df
commit 4091f73f34

View File

@ -503,6 +503,16 @@ class Repairer(common.ShareManglingMixin, unittest.TestCase):
def test_repair_from_corruption_of_1(self):
d = defer.succeed(None)
d.addCallback(self.find_shares)
stash = [None]
def _stash_it(res):
stash[0] = res
return res
d.addCallback(_stash_it)
def _put_it_all_back(ignored):
self.replace_shares(stash[0], storage_index=self.uri.storage_index)
return ignored
def _repair_from_corruption(unused, corruptor_func):
before_repair_reads = self._count_reads()
before_repair_allocates = self._count_writes()