]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
tests: add more diagnostics when code-under-test fails 23/head
authorZooko O'Whielacronx <zooko@zooko.com>
Thu, 29 Nov 2012 21:11:47 +0000 (14:11 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Thu, 29 Nov 2012 21:11:47 +0000 (14:11 -0700)
This prints out which things are different when two sets are expected to be the
same. This was useful to me when debugging the code under test. Hm, this
pattern might be more generally useful...

src/allmydata/test/test_repairer.py

index 0a6eb8c3917c35925465d7b991ebff7c94a2f7c0..0feaacb12162c369eb2f205da44c6dee34f74d1e 100644 (file)
@@ -716,6 +716,9 @@ class Repairer(GridTestMixin, unittest.TestCase, RepairTestMixin,
             # not respond to the pre-repair filecheck
             prr = rr.get_post_repair_results()
             expected = set(self.g.get_all_serverids())
+            responding_set = frozenset([s.get_serverid() for s in prr.get_servers_responding()])
+            self.failIf(expected - responding_set, expected - responding_set)
+            self.failIf(responding_set - expected, responding_set - expected)
             self.failUnlessEqual(expected,
                                  set([s.get_serverid()
                                       for s in prr.get_servers_responding()]))