def test_wsgi_service_with_ssl_enabled(self, wsgi_server): self.config(enable_ssl_api=True, group='api') service_name = 'mogan_api' srv = service.WSGIService('mogan_api', CONF.api.enable_ssl_api) wsgi_server.assert_called_once_with(CONF, service_name, srv.app, host='0.0.0.0', port=6688, use_ssl=True)
def test_workers_set_default(self, wsgi_server): service_name = "mogan_api" test_service = service.WSGIService(service_name) self.assertEqual(processutils.get_worker_count(), test_service.workers) wsgi_server.assert_called_once_with(CONF, service_name, test_service.app, host='0.0.0.0', port=6688, use_ssl=False)
def main(): gmr_opts.set_defaults(CONF) # Parse config file and command line options, then start logging mogan_service.prepare_service(sys.argv) gmr.TextGuruMeditation.setup_autorun(version, conf=CONF) # Build and start the WSGI app launcher = mogan_service.process_launcher() server = mogan_service.WSGIService('mogan_api', CONF.api.enable_ssl_api) launcher.launch_service(server, workers=server.workers) launcher.wait()
def test_workers_set_zero_setting(self, wsgi_server): self.config(api_workers=0, group='api') test_service = service.WSGIService("mogan_api") self.assertEqual(processutils.get_worker_count(), test_service.workers)
def test_workers_set_correct_setting(self, wsgi_server): self.config(api_workers=8, group='api') test_service = service.WSGIService("mogan_api") self.assertEqual(8, test_service.workers)