forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SIEM] Fixes toaster errors when siemDefault index is an empty or emp…
…ty spaces (elastic#73991) ## Summary Fixes fully this issue: elastic#49753 If you go to advanced settings and configure siemDefaultIndex to be an empty string or have empty spaces: <img width="1291" alt="Screen Shot 2020-07-31 at 12 52 00 PM" src="https://user-images.githubusercontent.com/1151048/89067511-a9434000-d32c-11ea-9106-e2079a5db317.png"> You shouldn't get any toaster errors when going to any of the pages such as overview, detections, etc... This fixes that and adds both unit and integration tests around those areas. The fix is to add a filter which will filter all the patterns out that are either empty strings or have the _all within them rather than just looking for a single value to exist. ### Checklist Delete any items that are not applicable to this PR. - [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
- Loading branch information
1 parent
5aca964
commit 75eda66
Showing
4 changed files
with
168 additions
and
42 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
x-pack/plugins/security_solution/server/graphql/source_status/resolvers.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { filterIndexes } from './resolvers'; | ||
|
||
describe('resolvers', () => { | ||
test('it should filter single index that has an empty string', () => { | ||
const emptyArray = filterIndexes(['']); | ||
expect(emptyArray).toEqual([]); | ||
}); | ||
|
||
test('it should filter single index that has blanks within it', () => { | ||
const emptyArray = filterIndexes([' ']); | ||
expect(emptyArray).toEqual([]); | ||
}); | ||
|
||
test('it should filter indexes that has an empty string and a valid index', () => { | ||
const emptyArray = filterIndexes(['', 'valid-index']); | ||
expect(emptyArray).toEqual(['valid-index']); | ||
}); | ||
|
||
test('it should filter indexes that have blanks within them and a valid index', () => { | ||
const emptyArray = filterIndexes([' ', 'valid-index']); | ||
expect(emptyArray).toEqual(['valid-index']); | ||
}); | ||
|
||
test('it should filter single index that has _all within it', () => { | ||
const emptyArray = filterIndexes(['_all']); | ||
expect(emptyArray).toEqual([]); | ||
}); | ||
|
||
test('it should filter single index that has _all within it surrounded by spaces', () => { | ||
const emptyArray = filterIndexes([' _all ']); | ||
expect(emptyArray).toEqual([]); | ||
}); | ||
|
||
test('it should filter indexes that _all within them and a valid index', () => { | ||
const emptyArray = filterIndexes(['_all', 'valid-index']); | ||
expect(emptyArray).toEqual(['valid-index']); | ||
}); | ||
|
||
test('it should filter indexes that _all surrounded with spaces within them and a valid index', () => { | ||
const emptyArray = filterIndexes([' _all ', 'valid-index']); | ||
expect(emptyArray).toEqual(['valid-index']); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters