def initialize_application(): objects.register_all() CONF(sys.argv[1:], project='cinder', version=version.version_string()) logging.setup(CONF, "cinder") config.set_middleware_defaults() rpc.init(CONF) service.setup_profiler(constants.API_BINARY, CONF.host) return wsgi.Loader(CONF).load_app(name='osapi_volume')
def test_profiler_enabled(self, context): service.CONF.profiler.enabled = True return_value = {"Meaning Of Life": 42} context.get_admin_context().to_dict.return_value = return_value service.setup_profiler(constants.VOLUME_BINARY, "localhost") service.osprofiler_initializer.init_from_conf.assert_called_once_with( conf=service.CONF, context=return_value, project="cinder", service=constants.VOLUME_BINARY, host="localhost")
def test_profiler_disabled(self): service.CONF.profiler.enabled = False service.setup_profiler(constants.VOLUME_BINARY, "localhost") service.osprofiler_initializer.init_from_conf.assert_not_called()
def test_profiler_not_present(self): service.profiler = None service.LOG.debug = mock.MagicMock() service.setup_profiler(constants.VOLUME_BINARY, "localhost") service.LOG.debug.assert_called_once_with("osprofiler is not present")
def test_profiler_disabled(self): service.CONF.profiler.enabled = False service.setup_profiler("cinder-volume", "localhost") service.osprofiler_initializer.init_from_conf.assert_not_called()
def test_profiler_not_present(self): service.profiler = None service.LOG.debug = mock.MagicMock() service.setup_profiler("cinder-volume", "localhost") service.LOG.debug.assert_called_once_with("osprofiler is not present")