]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2136] removed the do_polling method from the __init__ method of stats.Stats()
authorNaoki Kambe <kambe@jprs.co.jp>
Wed, 8 Aug 2012 12:22:45 +0000 (21:22 +0900)
committerNaoki Kambe <kambe@jprs.co.jp>
Thu, 9 Aug 2012 04:41:12 +0000 (13:41 +0900)
Because do_polling() is done when the show command is invoked, the do_polling
method didn't need to be done when the stats is starting.  Related to this
change, the b10-stats_test.py was changed. do_polling() is inserted before the
assertion of statistics_data.

src/bin/stats/stats.py.in
src/bin/stats/tests/b10-stats_test.py

index fd2df4969c628ce896e667eae272dfc385ab5c78..c1cd304da7dff006ab960814f0c1fa3e9f771b7b 100755 (executable)
@@ -205,8 +205,6 @@ class Stats:
                         self.module_name)
         # define the variable of the last time of polling
         self._lasttime_poll = 0.0
-        # try to do polling firstly
-        self.do_polling()
 
     def get_interval(self):
         """return the current value of 'poll-interval'"""
index d804136e4d921affcb9b09cf7cd41fa227c2dfd7..a6a51d535154528c40d27cc67a13d8b10d3361a8 100644 (file)
@@ -404,6 +404,7 @@ class TestStats(unittest.TestCase):
 
     def test_update_statistics_data_withmid(self):
         self.stats = stats.Stats()
+        self.stats.do_polling()
         # samples of query number
         bar1_tcp = 1001
         bar2_tcp = 2001
@@ -826,8 +827,8 @@ class TestStats(unittest.TestCase):
         stat = stats_server.server
         stats_server.run()
         self.assertEqual(
-            send_command('status', 'Stats'),
-            (0, "Stats is up. (PID " + str(os.getpid()) + ")"))
+            send_command('show', 'Stats'),
+            (0, stat.statistics_data))
         # check statistics data of 'Boss'
         boss = self.base.boss.server
         self.assertEqual(