Commit 7ccddd64 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2823] updated test_init_hterr so it also checks close_mccs is called.

parent 5bdee1a5
......@@ -642,10 +642,24 @@ class TestStatsHttpd(unittest.TestCase):
get_module_spec().get_module_name())
def test_init_hterr(self):
"""Test the behavior of StatsHttpd constructor when open_httpd fails.
We specifically check the following two:
- close_mccs() is called (so stats-httpd tells ConfigMgr it's shutting
down)
- the constructor results in HttpServerError exception.
"""
self.__mccs_closed = False
def __call_checker():
self.__mccs_closed = True
class FailingStatsHttpd(MyStatsHttpd):
def open_httpd(self):
raise stats_httpd.HttpServerError
def close_mccs(self):
__call_checker()
self.assertRaises(stats_httpd.HttpServerError, FailingStatsHttpd)
self.assertTrue(self.__mccs_closed)
def test_openclose_mccs(self):
self.stats_httpd = MyStatsHttpd(get_availaddr())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment