← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~twom/launchpad:stats-numbercruncher-info-error into launchpad:master

 

Tom Wardill has proposed merging ~twom/launchpad:stats-numbercruncher-info-error into launchpad:master.

Commit message:
Fix name of logging level

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/390406

A specific instance of a logger class has lower case logging level methods ('info'), not uppercase as in the definition ('INFO')
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:stats-numbercruncher-info-error into launchpad:master.
diff --git a/lib/lp/services/statsd/numbercruncher.py b/lib/lp/services/statsd/numbercruncher.py
index 0798719..d2301d0 100644
--- a/lib/lp/services/statsd/numbercruncher.py
+++ b/lib/lp/services/statsd/numbercruncher.py
@@ -119,7 +119,7 @@ class NumberCruncher(service.Service):
         self._updateBuilderCounts()
 
     def startService(self):
-        self.logger.INFO("Starting number-cruncher service.")
+        self.logger.info("Starting number-cruncher service.")
         self.update_queues_loop, self.update_queues_deferred = (
             self._startLoop(self.QUEUE_INTERVAL, self.updateBuilderQueues))
         self.update_builder_loop, self.update_builder_deferred = (
diff --git a/lib/lp/services/statsd/tests/test_numbercruncher.py b/lib/lp/services/statsd/tests/test_numbercruncher.py
index d812037..47c633f 100644
--- a/lib/lp/services/statsd/tests/test_numbercruncher.py
+++ b/lib/lp/services/statsd/tests/test_numbercruncher.py
@@ -113,3 +113,25 @@ class TestNumberCruncher(StatsMixin, TestCaseWithFactory):
                     build.processor.name), 1)),
                  Equals(('buildqueue,virtualized=False,arch=386', 1))
                  ]))
+
+    def test_startService_starts_update_queues_loop(self):
+        clock = task.Clock()
+        cruncher = NumberCruncher(clock=clock)
+
+        cruncher.updateBuilderQueues = FakeMethod()
+
+        cruncher.startService()
+        advance = NumberCruncher.QUEUE_INTERVAL + 1
+        clock.advance(advance)
+        self.assertNotEqual(0, cruncher.updateBuilderQueues.call_count)
+
+    def test_startService_starts_update_builders_loop(self):
+        clock = task.Clock()
+        cruncher = NumberCruncher(clock=clock)
+
+        cruncher.updateBuilderStats = FakeMethod()
+
+        cruncher.startService()
+        advance = NumberCruncher.BUILDER_INTERVAL + 1
+        clock.advance(advance)
+        self.assertNotEqual(0, cruncher.updateBuilderStats.call_count)