Browse Source

[2136] removed the do_polling method from the __init__ method of stats.Stats()

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.
Naoki Kambe 12 years ago
parent
commit
37ce3a0478
2 changed files with 3 additions and 4 deletions
  1. 0 2
      src/bin/stats/stats.py.in
  2. 3 2
      src/bin/stats/tests/b10-stats_test.py

+ 0 - 2
src/bin/stats/stats.py.in

@@ -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'"""

+ 3 - 2
src/bin/stats/tests/b10-stats_test.py

@@ -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(