Skip to content
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

[Security Solution] [Platform] Return additional errors during import rule + action migration process #123088

Merged
merged 3 commits into from
Jan 18, 2022

Conversation

dhurley14
Copy link
Contributor

@dhurley14 dhurley14 commented Jan 14, 2022

Summary

exposes additional errors when ES failures occur during the swap of old, pre-8.0 action ids with the new migrated action SO ids. Ref: #120975 (comment) for more information

Checklist

Delete any items that are not applicable to this PR.

For maintainers

…ld, pre-8.0 action ids with the new migrated action SO ids. Ref: elastic#120975 (comment) for more information
@dhurley14 dhurley14 self-assigned this Jan 14, 2022
@dhurley14 dhurley14 added auto-backport Deprecated - use backport:version if exact versions are needed Feature:Detection Rules Security Solution rules and Detection Engine Feature:Rule Actions Security Solution Detection Rule Actions area release_note:skip Skip the PR/issue when compiling release notes review Team:Security Solution Platform Security Solution Platform Team v8.0.0 v8.1.0 labels Jan 14, 2022
@dhurley14 dhurley14 marked this pull request as ready for review January 14, 2022 21:55
@dhurley14 dhurley14 requested a review from a team as a code owner January 14, 2022 21:55
@dhurley14
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @dhurley14


type PromiseFromStreams = ImportRulesSchemaDecoded | Error;

const createMockImportRule = async (rule: ReturnType<typeof getCreateRulesSchemaMock>) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wish we could put mocks in packages to share around!

const result = await swapActionIds(mockAction, soClient);
expect(result).toEqual(mockAction);
expect((result as Error).message).toEqual('failed to query');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if maybe this is a preferred pattern for these? Might need to tweak it a bit, but something like:

Suggested change
expect((result as Error).message).toEqual('failed to query');
await expect(() => swapActionIds(mockAction, soClient)).toThrowErrorMatchingInlineSnapshot('failed to query');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah I like that better. I'll update this!

Copy link
Contributor

@yctercero yctercero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for following up on this update here.

@dhurley14 dhurley14 merged commit 467d111 into elastic:main Jan 18, 2022
@dhurley14 dhurley14 deleted the expose-error-action-migration branch January 18, 2022 23:19
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 18, 2022
… rule + action migration process (elastic#123088)

* exposes additional errors when ES failures occur during the swap of old, pre-8.0 action ids with the new migrated action SO ids. Ref: elastic#120975 (comment) for more information

* fix test error

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit 467d111)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.0

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jan 19, 2022
… rule + action migration process (#123088) (#123329)

* exposes additional errors when ES failures occur during the swap of old, pre-8.0 action ids with the new migrated action SO ids. Ref: #120975 (comment) for more information

* fix test error

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit 467d111)

Co-authored-by: Devin W. Hurley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Detection Rules Security Solution rules and Detection Engine Feature:Rule Actions Security Solution Detection Rule Actions area release_note:skip Skip the PR/issue when compiling release notes review Team:Security Solution Platform Security Solution Platform Team v8.0.0 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants