From 4091f73f344762d03f31fad2b48b83e2430e6294 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Mon, 9 Feb 2009 18:29:56 -0700 Subject: [PATCH] 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. --- src/allmydata/test/test_repairer.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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() -- 2.45.2