]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
test_stats.py: improve test coverage
authorBrian Warner <warner@allmydata.com>
Wed, 30 Apr 2008 18:52:31 +0000 (11:52 -0700)
committerBrian Warner <warner@allmydata.com>
Wed, 30 Apr 2008 18:52:31 +0000 (11:52 -0700)
src/allmydata/test/test_stats.py

index 6a4434bf44ef9452d18f70ae1d978e3ad89d0d68..262866931e6f631ea9854d79b793bcba32c70e97 100644 (file)
@@ -8,7 +8,7 @@ class FasterMonitor(CPUUsageMonitor):
     POLL_INTERVAL = 0.1
 
 
-class CPUUsage(unittest.TestCase, testutil.PollMixin):
+class CPUUsage(unittest.TestCase, testutil.PollMixin, testutil.StallMixin):
     def setUp(self):
         self.s = service.MultiService()
         self.s.startService()
@@ -24,6 +24,9 @@ class CPUUsage(unittest.TestCase, testutil.PollMixin):
         def _poller():
             return bool(len(m.samples) == m.HISTORY_LENGTH+1)
         d = self.poll(_poller)
+        # pause one more second, to make sure that the history-trimming code
+        # is exercised
+        d.addCallback(self.stall, 1.0)
         def _check(res):
             s = m.get_stats()
             self.failUnless("cpu_monitor.1min_avg" in s)