From: Brian Warner Date: Thu, 8 May 2008 00:00:47 +0000 (-0700) Subject: test_util: improve ConcurrencyLimiter tests X-Git-Tag: allmydata-tahoe-1.1.0~151 X-Git-Url: https://git.rkrishnan.org/listings/copyable-send.py?a=commitdiff_plain;h=15a9f3d01b8a6ab78b36d912db8ba10e1b412595;p=tahoe-lafs%2Ftahoe-lafs.git test_util: improve ConcurrencyLimiter tests --- diff --git a/src/allmydata/test/test_util.py b/src/allmydata/test/test_util.py index c990ca9c..7eb8c120 100644 --- a/src/allmydata/test/test_util.py +++ b/src/allmydata/test/test_util.py @@ -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):