def setUp(cls): assert cls.httpd is None, 'Layer already set up' cls.httpd = HTTPServer(('localhost', 8180), TestableHandler) cls._thread = threading.Thread(target=cls.httpd.serve_forever) cls._thread.daemon = True cls._thread.start() wait_for_webservice('localhost', 8180)
def test_sighup_restart(self): # The REST runner must survive a SIGHUP. wait_for_webservice() for pid in self.layer.server.runner_pids: os.kill(pid, signal.SIGHUP) wait_for_webservice() # This should not raise an exception. The best way to assert this is # to ensure that the response is valid. response, json = call_api("http://localhost:9001/3.0/system") self.assertEqual(json["content-location"], "http://localhost:9001/3.0/system")
def test_sighup_restart(self): # The REST runner must survive a SIGHUP. wait_for_webservice() for pid in self.layer.server.runner_pids: os.kill(pid, signal.SIGHUP) wait_for_webservice() # This should not raise an exception. The best way to assert this is # to ensure that the response is valid. json, response = call_api('http://localhost:9001/3.0/system/versions') self.assertEqual(json['self_link'], 'http://localhost:9001/3.0/system/versions')
def _wait_for_both(cls): cls.client = get_lmtp_client(quiet=True) wait_for_webservice()