]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
test_util: improve ConcurrencyLimiter tests
authorBrian Warner <warner@allmydata.com>
Thu, 8 May 2008 00:00:47 +0000 (17:00 -0700)
committerBrian Warner <warner@allmydata.com>
Thu, 8 May 2008 00:00:47 +0000 (17:00 -0700)
src/allmydata/test/test_util.py

index c990ca9c9fa5e6c08a95b994dcd3467781640c4a..7eb8c120b463f077673ed572e86b316f9ea108e3 100644 (file)
@@ -453,7 +453,7 @@ class Limiter(unittest.TestCase):
         d = defer.Deferred()
         def _done():
             self.simultaneous -= 1
-            d.callback("done")
+            d.callback("done %d" % i)
         reactor.callLater(1.0, _done)
         return d
 
@@ -489,6 +489,14 @@ class Limiter(unittest.TestCase):
         d2 = l.add(self.bad_job, 21, "21")
         d = defer.DeferredList(dl, fireOnOneErrback=True)
         def _most_done(res):
+            results = []
+            for (success, result) in res:
+                self.failUnlessEqual(success, True)
+                results.append(result)
+            results.sort()
+            expected_results = ["done %d" % i for i in range(20)]
+            expected_results.sort()
+            self.failUnlessEqual(results, expected_results)
             self.failUnless(self.peak_simultaneous <= 10)
             self.failUnlessEqual(len(self.calls), 20)
             for i in range(20):