From: Zooko O'Whielacronx Date: Tue, 10 Feb 2009 01:29:56 +0000 (-0700) Subject: immutable: tests: put shares back to their pristine condition in between each test... X-Git-Tag: allmydata-tahoe-1.3.0~56 X-Git-Url: https://git.rkrishnan.org/?a=commitdiff_plain;h=4091f73f344762d03f31fad2b48b83e2430e6294;p=tahoe-lafs%2Ftahoe-lafs.git 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. --- diff --git a/src/allmydata/test/test_repairer.py b/src/allmydata/test/test_repairer.py index 621c7b6a..2bb7d604 100644 --- a/src/allmydata/test/test_repairer.py +++ b/src/allmydata/test/test_repairer.py @@ -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()