[RAC][Rule Registry] Add functional API test for createLifecycleExector#121465
[RAC][Rule Registry] Add functional API test for createLifecycleExector#121465simianhacker merged 17 commits intoelastic:mainfrom
Conversation
…itch-to-sorce-followup
|
Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI) |
x-pack/test/rule_registry/spaces_only/tests/trial/lifecycle_executor.ts
Outdated
Show resolved
Hide resolved
| mappings: mappingFromFieldMap( | ||
| { | ||
| testObject: { | ||
| type: 'object', |
There was a problem hiding this comment.
Awesome that you test here the object type. Once your PR is merged, I would be curious to test with the recently added flattened type as well.
x-pack/test/rule_registry/spaces_only/tests/trial/lifecycle_executor.ts
Outdated
Show resolved
Hide resolved
mgiota
left a comment
There was a problem hiding this comment.
I happily approve this PR! @simianhacker great stuff!
| id, | ||
| fields: { | ||
| [ALERT_REASON]: 'Test alert is firing', | ||
| ...state, |
There was a problem hiding this comment.
@simianhacker Can you explain maybe a bit more what you are doing here? Based on this https://github.com/elastic/kibana/blob/main/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.ts#L102 when calling alertWithLifecycle we pass the fields we want to index. So you index a new key called testObject, right?
There was a problem hiding this comment.
Yes, spreading the state will add the testObject to the index. When I was poking around in different solutions, I noticed that each plugin used alertWithLifecycle to add their additional metadata.
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
Summary
This PR is a follow up to #118245. This adds test to ensure the rule registry can write, read, and the write back objects on the alert as data indices. I've also annotated the
lifecycle_executortest with comments about where each part of the Rule Registry is called in Kibana, this should help the next set of engineers understand all the moving parts.Checklist