def UpdateConfigs(): # pylint: disable=unused-variable """Poll the luci-config service.""" try: configs = luci_config.FindAllSheriffConfigs(config_client) luci_config.StoreConfigs(datastore_client, configs.get('configs', [])) return jsonify({}) except (luci_config.InvalidConfigError, luci_config.InvalidContentError) as error: logging.warning('loading configs from luci-config failed: %s', error) return jsonify({}), 500
def UpdateConfigs(): # pylint: disable=unused-variable """Poll the luci-config service.""" try: configs = luci_config.FindAllSheriffConfigs(config_client) luci_config.StoreConfigs(datastore_client, configs.get('configs', [])) return jsonify({}) except (luci_config.InvalidConfigError, luci_config.InvalidContentError) as error: app.logger.debug(error) return jsonify({}), 500
def testFindingAllSheriffConfigs(self): with open('tests/config-discovery.json') as discovery_file: discovery_response = discovery_file.read() with open('tests/configs-projects-empty.json') as configs_get_projects_file: configs_get_projects_response = configs_get_projects_file.read() http = HttpMockSequence([({ 'status': '200' }, discovery_response), ({ 'status': '200' }, configs_get_projects_response)]) service = luci_config.CreateConfigClient(http=http) self.assertEqual({}, luci_config.FindAllSheriffConfigs(service))
def testFindingAllSheriffConfigs(self): with open('tests/configs-projects-empty.json' ) as configs_get_projects_file: configs_get_projects_response = configs_get_projects_file.read() http = HttpMockSequenceWithDiscovery([ ({ 'status': '200' }, configs_get_projects_response), ]) service = service_client.CreateServiceClient( 'https://luci-config.appspot.com/_ah/api', 'config', 'v1', http=http) _ = service_client.CreateServiceClient( 'https://chrome-infra-auth.appspot.com/_ah/api', 'auth', 'v1', http=http) self.assertEqual({}, luci_config.FindAllSheriffConfigs(service))