mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ResponseOps][Alerts] Add missing featureIds to AlertsClient find (#190486)
## Summary Forwards `featureIds` from `AlertsClient.find()` to `AlertsClient.searchAlerts()` ### References Fixes #190424 ### Checklist Delete any items that are not applicable to this PR. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
This commit is contained in:
parent
e66098a0a4
commit
bc4c6d7eac
2 changed files with 16 additions and 2 deletions
|
@ -1017,6 +1017,7 @@ export class AlertsClient {
|
|||
}
|
||||
|
||||
const alertsSearchResponse = await this.searchAlerts<TAggregations>({
|
||||
featureIds,
|
||||
query,
|
||||
aggs,
|
||||
_source,
|
||||
|
|
|
@ -74,6 +74,8 @@ beforeEach(() => {
|
|||
describe('find()', () => {
|
||||
test('calls ES client with given params', async () => {
|
||||
const alertsClient = new AlertsClient(alertsClientParams);
|
||||
const searchAlertsSpy = jest.spyOn(alertsClient as any, 'searchAlerts');
|
||||
alertsClient.getAuthorizedAlertsIndices = jest.fn().mockResolvedValue([]);
|
||||
esClientMock.search.mockResponseOnce({
|
||||
took: 5,
|
||||
timed_out: false,
|
||||
|
@ -107,10 +109,21 @@ describe('find()', () => {
|
|||
],
|
||||
},
|
||||
});
|
||||
const query = { match: { [ALERT_WORKFLOW_STATUS]: 'open' } };
|
||||
const index = '.alerts-observability.apm.alerts';
|
||||
const featureIds = ['siem'];
|
||||
const result = await alertsClient.find({
|
||||
query: { match: { [ALERT_WORKFLOW_STATUS]: 'open' } },
|
||||
index: '.alerts-observability.apm.alerts',
|
||||
query,
|
||||
index,
|
||||
featureIds,
|
||||
});
|
||||
expect(searchAlertsSpy).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
query,
|
||||
index,
|
||||
featureIds,
|
||||
})
|
||||
);
|
||||
expect(result).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"_shards": Object {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue