[Maps] Handle cross cluster index _settings resp (#66797)

This commit is contained in:
Nathan Reese 2020-05-15 14:18:39 -06:00 committed by GitHub
parent ab2600f823
commit 8dc8aa0c64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -29,5 +29,9 @@ export function getIndexPatternSettings(indicesSettingsResp) {
maxInnerResultWindow = Math.min(indexMaxInnerResultWindow, indexMaxResultWindow);
});
return { maxResultWindow, maxInnerResultWindow };
return {
maxResultWindow: maxResultWindow === Infinity ? DEFAULT_MAX_RESULT_WINDOW : maxResultWindow,
maxInnerResultWindow:
maxInnerResultWindow === Infinity ? DEFAULT_MAX_INNER_RESULT_WINDOW : maxInnerResultWindow,
};
}

View file

@ -24,6 +24,14 @@ describe('max_result_window and max_inner_result_window are not set', () => {
expect(maxInnerResultWindow).toBe(DEFAULT_MAX_INNER_RESULT_WINDOW);
});
test('Should provide default values from cross cluster index response', () => {
// _settings returns empty object for cross cluster index
const indicesSettingsResp = {};
const { maxResultWindow, maxInnerResultWindow } = getIndexPatternSettings(indicesSettingsResp);
expect(maxResultWindow).toBe(DEFAULT_MAX_RESULT_WINDOW);
expect(maxInnerResultWindow).toBe(DEFAULT_MAX_INNER_RESULT_WINDOW);
});
test('Should include default values when providing minimum values for indices in index pattern', () => {
const indicesSettingsResp = {
kibana_sample_data_logs: {