def _get_config_manager(config, es_index=None): if not es_index: es_index = config.elasticsearch_index mock_logging = mock.Mock() required_config = crashstorage.ElasticSearchCrashStorage.get_required_config() required_config.add_option("logger", default=mock_logging) webapi = Namespace() webapi.elasticsearch_index = es_index webapi.timeout = 2 webapi.search_default_date_range = 7 for opt in [ "elasticSearchHostname", "elasticSearchPort", "elasticsearch_doctype", "elasticsearch_timeout", "facets_max_number", "searchMaxNumberOfDistinctSignatures", "platforms", "non_release_channels", "restricted_channels", ]: webapi[opt] = config.get(opt) required_config.webapi = webapi elasticsearch_url = "http://" + config.elasticSearchHostname + ":9200" config_manager = ConfigurationManager( [required_config], app_name="testapp", app_version="1.0", app_description="app description", values_source_list=[ { "logger": mock_logging, "elasticsearch_index": es_index, "elasticsearch_urls": elasticsearch_url, "backoff_delays": [1, 2], } ], ) return config_manager
def _get_config_manager(config, es_index=None): if not es_index: es_index = config.elasticsearch_index mock_logging = mock.Mock() required_config = \ crashstorage.ElasticSearchCrashStorage.get_required_config() required_config.add_option('logger', default=mock_logging) webapi = Namespace() webapi.elasticsearch_index = es_index webapi.timeout = 2 webapi.search_default_date_range = 7 for opt in [ 'elasticSearchHostname', 'elasticSearchPort', 'elasticsearch_doctype', 'elasticsearch_timeout', 'facets_max_number', 'searchMaxNumberOfDistinctSignatures', 'platforms', 'non_release_channels', 'restricted_channels', ]: webapi[opt] = config.get(opt) required_config.webapi = webapi elasticsearch_url = 'http://' + config.elasticSearchHostname + ':9200' config_manager = ConfigurationManager([required_config], app_name='testapp', app_version='1.0', app_description='app description', values_source_list=[{ 'logger': mock_logging, 'elasticsearch_index': es_index, 'elasticsearch_urls': elasticsearch_url, 'backoff_delays': [1, 2], }]) return config_manager
def get_config_manager(self): mock_logging = mock.Mock() required_config = \ crashstorage.ElasticSearchCrashStorage.required_config required_config.add_option('logger', default=mock_logging) webapi = Namespace() webapi.elasticSearchHostname = 'localhost' webapi.elasticSearchPort = 9200 webapi.elasticsearch_index = 'socorro_integration_test' webapi.elasticsearch_doctype = 'crash_reports' webapi.searchMaxNumberOfDistinctSignatures = 1000 webapi.timeout = 2 webapi.platforms = ( { "id": "windows", "name": "Windows NT" }, { "id": "linux", "name": "Linux" }, { "id": "mac", "name": "Mac OS X" } ) webapi.channels = ['beta', 'aurora', 'nightly'] webapi.restricted_channels = ['beta'] required_config.webapi = webapi config_manager = ConfigurationManager( [required_config], app_name='testapp', app_version='1.0', app_description='app description', values_source_list=[{ 'logger': mock_logging, 'elasticsearch_urls': 'http://localhost:9200', 'elasticsearch_index': 'socorro_integration_test', }] ) return config_manager
def _get_config_manager(config, es_index=None): if not es_index: es_index = config.elasticsearch_index mock_logging = mock.Mock() required_config = \ crashstorage.ElasticSearchCrashStorage.get_required_config() required_config.add_option('logger', default=mock_logging) webapi = Namespace() webapi.elasticsearch_index = es_index webapi.timeout = 2 webapi.search_default_date_range = 7 for opt in [ 'elasticSearchHostname', 'elasticSearchPort', 'elasticsearch_doctype', 'elasticsearch_timeout', 'facets_max_number', 'searchMaxNumberOfDistinctSignatures', 'platforms', 'non_release_channels', 'restricted_channels', ]: webapi[opt] = config.get(opt) required_config.webapi = webapi elasticsearch_url = 'http://' + config.elasticSearchHostname + ':9200' config_manager = ConfigurationManager( [required_config], app_name='testapp', app_version='1.0', app_description='app description', values_source_list=[{ 'logger': mock_logging, 'elasticsearch_index': es_index, 'elasticsearch_urls': elasticsearch_url, 'backoff_delays': [1, 2], }] ) return config_manager
def _get_config_manager(es_index=None): if not es_index: es_index = commonconfig.elasticsearch_index.default mock_logging = mock.Mock() required_config = \ crashstorage.ElasticSearchCrashStorage.required_config required_config.add_option('logger', default=mock_logging) webapi = Namespace() webapi.elasticsearch_index = es_index webapi.timeout = 2 webapi.search_default_date_range = 7 for opt in [ 'elasticSearchHostname', 'elasticSearchPort', 'elasticsearch_doctype', 'elasticsearch_timeout', 'facets_max_number', 'searchMaxNumberOfDistinctSignatures', 'platforms', 'channels', 'restricted_channels', ]: webapi[opt] = getattr(commonconfig, opt).default required_config.webapi = webapi config_manager = ConfigurationManager( [required_config], app_name='testapp', app_version='1.0', app_description='app description', values_source_list=[{ 'logger': mock_logging, 'elasticsearch_urls': commonconfig.elasticsearch_urls.default, 'elasticsearch_index': es_index, }] ) return config_manager
def get_config_manager(self): mock_logging = mock.Mock() required_config = \ crashstorage.ElasticSearchCrashStorage.get_required_config() required_config.add_option('logger', default=mock_logging) webapi = Namespace() webapi.timeout = 2 for opt in [ 'elasticSearchHostname', 'elasticSearchPort', 'elasticsearch_urls', 'elasticsearch_index', 'elasticsearch_doctype', 'elasticsearch_timeout', 'searchMaxNumberOfDistinctSignatures', 'platforms', 'non_release_channels', 'restricted_channels', ]: webapi[opt] = self.config.get(opt) required_config.webapi = webapi config_manager = ConfigurationManager( [required_config], app_name='testapp', app_version='1.0', app_description='app description', values_source_list=[{ 'logger': mock_logging, 'elasticsearch_index': webapi.elasticsearch_index, 'elasticsearch_urls': webapi.elasticsearch_urls, 'backoff_delays': [1, 2], }], argv_source=[] ) return config_manager
def get_config_manager(self): mock_logging = mock.Mock() required_config = \ crashstorage.ElasticSearchCrashStorage.get_required_config() required_config.add_option('logger', default=mock_logging) webapi = Namespace() webapi.timeout = 2 for opt in [ 'elasticSearchHostname', 'elasticSearchPort', 'elasticsearch_urls', 'elasticsearch_index', 'elasticsearch_doctype', 'elasticsearch_timeout', 'searchMaxNumberOfDistinctSignatures', 'platforms', 'non_release_channels', 'restricted_channels', ]: webapi[opt] = self.config.get(opt) required_config.webapi = webapi config_manager = ConfigurationManager( [required_config], app_name='testapp', app_version='1.0', app_description='app description', values_source_list=[{ 'logger': mock_logging, 'elasticsearch_index': webapi.elasticsearch_index, 'elasticsearch_urls': webapi.elasticsearch_urls, 'backoff_delays': [1, 2], }] ) return config_manager