From 4ada923e2b73fd424ca79c20a789154e502326fb Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Tue, 6 Jan 2009 13:04:49 -0700
Subject: [PATCH] immutable: tests: verifier doesn't always catch corrupted
 share hashes Maybe it already got one of the corrupted hashes from a
 different server and it doesn't double-check that the hash from every server
 is correct.  Or another problem.  But in any case I'm marking this as TODO
 because an even better (more picky) verifier is less urgent than repairer.

---
 src/allmydata/test/test_immutable.py | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/allmydata/test/test_immutable.py b/src/allmydata/test/test_immutable.py
index cae689a4..34ee3a84 100644
--- a/src/allmydata/test/test_immutable.py
+++ b/src/allmydata/test/test_immutable.py
@@ -633,7 +633,6 @@ class Test(ShareManglingMixin, unittest.TestCase):
             _corrupt_offset_of_uri_extension,
             _corrupt_offset_of_uri_extension_to_force_short_read,
             _corrupt_share_data,
-            _corrupt_share_hashes,
             _corrupt_length_of_uri_extension,
             _corrupt_uri_extension,
             ], judge)
@@ -757,6 +756,26 @@ class Test(ShareManglingMixin, unittest.TestCase):
             ], judge)
     test_verify_server_invisible_corruption_block_hash_tree_TODO.todo = "Verifier doesn't yet properly detect this kind of corruption."
 
+    def test_verify_server_invisible_corruption_share_hash_tree_TODO(self):
+        def judge(checkresults):
+            self.failIf(checkresults.is_healthy(), (checkresults, checkresults.is_healthy(), checkresults.get_data()))
+            data = checkresults.get_data()
+            self.failUnless(data['count-shares-good'] == 9, data)
+            self.failUnless(data['count-shares-needed'] == 3, data)
+            self.failUnless(data['count-shares-expected'] == 10, data)
+            self.failUnless(data['count-good-share-hosts'] == 5, data)
+            self.failUnless(data['count-corrupt-shares'] == 1, (data,))
+            self.failUnless(len(data['list-corrupt-shares']) == 1, data)
+            self.failUnless(len(data['list-corrupt-shares']) == data['count-corrupt-shares'], data)
+            self.failUnless(len(data['list-incompatible-shares']) == data['count-incompatible-shares'], data)
+            self.failUnless(len(data['list-incompatible-shares']) == 0, data)
+            self.failUnless(len(data['servers-responding']) == 5, data)
+            self.failUnless(len(data['sharemap']) == 9, data)
+        return self._help_test_verify([
+            _corrupt_share_hashes,
+            ], judge)
+    test_verify_server_invisible_corruption_share_hash_tree_TODO.todo = "Verifier doesn't yet properly detect this kind of corruption."
+
     def test_repair(self):
         """ Repair replaces a share that got deleted. """
         # N == 10.  7 is the "efficiency leeway" -- we'll allow you to pass this test even if
-- 
2.45.2