]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
immutable: tests: put shares back to their pristine condition in between each test...
authorZooko O'Whielacronx <zooko@zooko.com>
Tue, 10 Feb 2009 01:29:56 +0000 (18:29 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Tue, 10 Feb 2009 01:29:56 +0000 (18:29 -0700)
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

index 621c7b6a68571b7859e736a328c5d6f0e85f4cbe..2bb7d604c1311fecca2451820c35f1cca1de8fcd 100644 (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()