From 84a57785078169357c59e194da57cd5f3c8c0d34 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Tue, 9 Sep 2008 17:30:10 -0700
Subject: [PATCH] checker results: more tests, update interface docs

---
 src/allmydata/interfaces.py       | 19 ++++++++++++++-----
 src/allmydata/test/test_system.py |  3 +++
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py
index 90676948..16ce8689 100644
--- a/src/allmydata/interfaces.py
+++ b/src/allmydata/interfaces.py
@@ -1560,11 +1560,20 @@ class ICheckerResults(Interface):
                    'seq%d-%s-sh%d', containing the sequence number, the
                    roothash, and the share number.
 
-        Mutable files will add the following keys::
-
-         count-wrong-shares: the number of shares for versions other than
-                             the 'best' one (highest sequence number, highest
-                             roothash). These are either old ...
+        The following keys are most relevant for mutable files, but immutable
+        files will provide sensible values too::
+
+         count-wrong-shares: the number of shares for versions other than the
+                             'best' one (which is defined as being the
+                             recoverable version with the highest sequence
+                             number, then the highest roothash). These are
+                             either leftover shares from an older version
+                             (perhaps on a server that was offline when an
+                             update occurred), shares from an unrecoverable
+                             newer version, or shares from an alternate
+                             current version that results from an
+                             uncoordinated write collision. For a healthy
+                             file, this will equal 0.
 
          count-recoverable-versions: the number of recoverable versions of
                                      the file. For a healthy file, this will
diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py
index aa85d397..20e07669 100644
--- a/src/allmydata/test/test_system.py
+++ b/src/allmydata/test/test_system.py
@@ -2043,6 +2043,9 @@ class DeepCheck(SystemTestMixin, unittest.TestCase):
                              sorted([idlib.nodeid_b2a(c.nodeid)
                                      for c in self.clients]), where)
         #self.failUnless("sharemap" in d)
+        self.failUnlessEqual(d["count-wrong-shares"], 0, where)
+        self.failUnlessEqual(d["count-recoverable-versions"], 1, where)
+        self.failUnlessEqual(d["count-unrecoverable-versions"], 0, where)
 
 
     def check_and_repair_is_healthy(self, cr, where):
-- 
2.45.2