From 15a9f3d01b8a6ab78b36d912db8ba10e1b412595 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 7 May 2008 17:00:47 -0700 Subject: [PATCH] test_util: improve ConcurrencyLimiter tests --- src/allmydata/test/test_util.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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): -- 2.45.2