From 0771dadf142337577c737f6e78eee5bffb066c37 Mon Sep 17 00:00:00 2001 From: Prasanna Jeevan Devanur Nagabhushan Date: Fri, 15 Jul 2016 12:43:42 -0700 Subject: [PATCH 1/3] measure_interval was never stored --- mutornadomon/monitor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mutornadomon/monitor.py b/mutornadomon/monitor.py index 3ef8f85..8ddc9db 100644 --- a/mutornadomon/monitor.py +++ b/mutornadomon/monitor.py @@ -42,6 +42,8 @@ def __init__( self.collectors = collectors self.io_loop = io_loop or tornado.ioloop.IOLoop.current() + self.measure_interval = measure_interval + self.measure_callback = tornado.ioloop.PeriodicCallback( self._cb, measure_interval, From 66291e67bc6a585b68d97abd8453525061fff76f Mon Sep 17 00:00:00 2001 From: Prasanna Jeevan Devanur Nagabhushan Date: Fri, 15 Jul 2016 15:54:35 -0700 Subject: [PATCH 2/3] Added unit tests to check MuTornadoMon --- requirements-test.txt | 1 + tests/test_config.py | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/requirements-test.txt b/requirements-test.txt index 646b372..3c22ccd 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,3 +1,4 @@ nose>=1.3 coverage coveralls +ipcalc diff --git a/tests/test_config.py b/tests/test_config.py index 4cd6ce9..9118892 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -6,6 +6,7 @@ import tornado.ioloop import unittest +from mutornadomon import MuTornadoMon from mutornadomon.config import initialize_mutornadomon from mutornadomon.external_interfaces import (HTTPEndpointExternalInterface, PublishExternalInterface) @@ -118,3 +119,13 @@ def test_initialize_mutornadomon_raises_when_no_publisher_and_no_app(self, perio """Test instrument_ioloop() setups monitoring and creates a PeriodicCallback""" self.assertRaises(ValueError, initialize_mutornadomon, io_loop=tornado.ioloop.IOLoop.current()) + + @mock.patch('mutornadomon.external_interfaces.PublishExternalInterface') + def test_initialize_MuTornadoMon(self, pub_ext_iface_mock): + external_interface = pub_ext_iface_mock.return_value + monitor = MuTornadoMon(external_interface) + + #check if no exceptions are raised + monitor.start() + monitor._cb() + monitor.stop() From 52ea7d3f72ae2b0cf52a6f71838c6821fbf54985 Mon Sep 17 00:00:00 2001 From: Prasanna Jeevan Devanur Nagabhushan Date: Fri, 15 Jul 2016 16:31:10 -0700 Subject: [PATCH 3/3] Moved ipcalc to requirements.txt --- requirements-test.txt | 1 - requirements.txt | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index 3c22ccd..646b372 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,3 @@ nose>=1.3 coverage coveralls -ipcalc diff --git a/requirements.txt b/requirements.txt index 8c1ca3c..66b7450 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ tornado>=3.0 psutil>=1.2.0 mock>=0.9 six +ipcalc