]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2823] updated test_init_hterr so it also checks close_mccs is called.
authorJINMEI Tatuya <jinmei@isc.org>
Mon, 6 May 2013 23:22:21 +0000 (16:22 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Mon, 6 May 2013 23:22:21 +0000 (16:22 -0700)
src/bin/stats/tests/stats-httpd_test.py

index bf338955b2f60c3ef94acf19aff412480a57c9f7..37ea7e3cf0c074f6bf00981c2b16be489b901228 100644 (file)
@@ -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())