Browse Source

[2823-regression] shutdown MyStatsHttpd running on a separate thread

the dangling threads do not necessarily do harm (test failure, etc),
but show confusing behaviors such as leaked exception.  explicit shutdown
should prevent these (for a longer term, we should really stop using threads
for the http-handler tests)
JINMEI Tatuya 12 years ago
parent
commit
5fcf58d121
2 changed files with 4 additions and 0 deletions
  1. 1 0
      src/bin/stats/tests/stats-httpd_test.py
  2. 3 0
      src/bin/stats/tests/test_utils.py

+ 1 - 0
src/bin/stats/tests/stats-httpd_test.py

@@ -248,6 +248,7 @@ class TestHttpHandler(unittest.TestCase):
 
     def tearDown(self):
         self.client.close()
+        self.stats_httpd_server.shutdown()
         # reset the signal handler
         self.sig_handler.reset()
 

+ 3 - 0
src/bin/stats/tests/test_utils.py

@@ -562,3 +562,6 @@ class MyStatsHttpd(stats_httpd.StatsHttpd):
     def run(self):
         self._started.set()
         self.start()
+
+    def shutdown(self):
+        self.command_handler('shutdown', None)