-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Alerting] fixes to allow pre-configured actions to be executed #63432
[Alerting] fixes to allow pre-configured actions to be executed #63432
Conversation
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
resolves elastic#63162 Most of the support for pre-configured actions has already been added to Kibana, except for one small piece. The ability for them to be executed. This PR adds that support.
a930ba2
to
8f069f2
Compare
@@ -68,6 +69,68 @@ describe('execute()', () => { | |||
}); | |||
}); | |||
|
|||
test('schedules the action with all given parameters with a preconfigured action', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a copy of the test above it, only changing to use a preconfigured action.
params: { | ||
spaceId, | ||
actionTaskParamsId: actionTaskParamsRecord.id, | ||
}, | ||
state: {}, | ||
scope: ['actions'], | ||
}); | ||
|
||
async function getActionTypeId(actionId: string): Promise<string> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a side note, we might want to look at denormalizing the action type along side action id, where appropriate, to avoid this SO lookup just to get the action type. OTOH, it's only when actions are executed, so ... it's not on every turn of an alert ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Moment not writing a comment haunts me): I think the lookup is also there to ensure the user has access to read that action, otherwise it would fail the attempt to create a task executing that action.
Sigh note, this would also mean pre-configured actions don't work with feature controls at this time. I will open a separate issue for that, to test and validate that theory but the implementation below looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created issue here: #63496.
@@ -100,6 +100,27 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions) | |||
xyzSecret2: 'credential2', | |||
}, | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More pre-configured actions, used in the tests below. Show up in the various getAll()
tests as well ...
const ES_TEST_INDEX_NAME = 'functional-test-actions-index-preconfigured'; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default function indexTest({ getService }: FtrProviderContext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was copied from es_index.ts
, but only tests a pre-configured action, and only that you can execute it.
@@ -165,6 +165,100 @@ instanceStateValue: true | |||
} | |||
}); | |||
|
|||
it('should schedule task, run alert and schedule preconfigured actions when appropriate', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a copy of the test above it, but with a preconfigured action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, I will open up an issue about feature controls testing on pre-configured actions.
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
…tic#63432) resolves elastic#63162 Most of the support for pre-configured actions has already been added to Kibana, except for one small piece. The ability for them to be executed. This PR adds that support.
* master: (29 commits) Add test:jest_integration npm script (elastic#62938) [data.search.aggs] Remove service getters from agg types (AggConfig part) (elastic#62548) [Discover] Fix broken setting of bucketInterval (elastic#62939) Disable adding conditions when in alert management context. (elastic#63514) [Alerting] fixes to allow pre-configured actions to be executed (elastic#63432) adding useMemo (elastic#63504) [Maps] fix double fetch when filter pill is added (elastic#63024) [Lens] Fix missing formatting bug in "break down by" (elastic#63288) [SIEM] [Cases] Removed double pasted line (elastic#63507) [Reporting] Improve functional test steps (elastic#63259) [SIEM][CASE] Tests for server's configuration API (elastic#63099) [SIEM] [Cases] Case container unit tests (elastic#63376) [ML] Improving parsing of large uploaded files (elastic#62970) [ML] Listing global calendars on the job management page (elastic#63124) [Ingest][Endpoint] Add Ingest rest api response types for use in Endpoint (elastic#63373) Add help text to form fields (elastic#63165) [ML] Converts utils Mocha tests to Jest (elastic#63132) [Metrics UI] Refactor With* containers to hooks (elastic#59503) [NP] Migrate logstash server side code to NP (elastic#63135) Clicking cancel in saved query save modal doesn't close it (elastic#62774) ...
resolves #63162 Most of the support for pre-configured actions has already been added to Kibana, except for one small piece. The ability for them to be executed. This PR adds that support.
resolves #63162
Most of the support for pre-configured actions has already been added
to Kibana, except for one small piece. The ability for them to be
executed. This PR adds that support.
Checklist