-
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
[Cases] Case action: Integration tests #178277
Conversation
/ci |
@@ -669,6 +669,34 @@ | |||
} | |||
} | |||
}, | |||
"cases-oracle": { |
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.
The PR is going to be merged into a feature branch. There is no need for a thorough review at the moment.
Pinging @elastic/response-ops (Team:ResponseOps) |
Pinging @elastic/response-ops-cases (Feature:Cases) |
rule: { id: rule.id, name: rule.name }, | ||
owner: theCase.owner, | ||
})), | ||
attachments: [ |
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.
Instead of creating one attachment per alert, we create one attachment with all alerts included in the attachment. This will reduce the amount of SO created.
@@ -43,4 +53,14 @@ export const getCasesConnectorType = ({ | |||
* TODO: Verify license | |||
*/ | |||
minimumLicenseRequired: 'platinum' as const, | |||
isSystemActionType: true, | |||
getKibanaPrivileges: ({ params } = { params: { subAction: 'run', subActionParams: {} } }) => { |
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.
Registers the required kibana privileges the case action needs to run.
/ci |
/ci |
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.
Awesome integration tests!! 😃 Great work 🎉
@@ -78,3 +78,7 @@ export const buildRequiredCustomFieldsForRequest = ( | |||
}) | |||
: []; | |||
}; | |||
|
|||
export const constructRequiredKibanaPrivileges = (owner: string): string[] => { | |||
return [`cases:${owner}/createCase`, `cases:${owner}/updateCase`]; |
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.
I guess for case action user doesn't need to have delete permission, right?
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.
Good point. At the moment the case action does not do any delete operation but I will add it just to be safe in case we need it in the future.
const kibanaServer = getService('kibanaServer'); | ||
|
||
describe('Case connector', () => { | ||
const connectorId = 'system-connector-.cases'; |
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.
Shouldn't this be just .cases
?
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.
The actions framework generates the connector's ID automatically by pretending system-connector-
to all system connectors.
💔 Build FailedFailed CI StepsTest Failures
Metrics [docs]
History
To update your PR or re-run it, just comment with: cc @cnasikas |
## Summary Depends on: #166267, #170326, #169484, #173740, #173763, #178068, #178307, #178600, #180437 PRs: - #168370 - #169229 - #171754 - #172709 - #173012 - #175107 - #175452 - #175505 - #177033 - #178277 - #177139 - #179796 Fixes: #153837 ## Testing Run Kibana with `--run-examples` if you want to use the "Always firing" rule. Create a rule with a case action in observability and the stack. The security solution is not supported. You should not be able to assign a case action in a security solution rule. 1. Test the "Reopen closed cases" configuration. 2. Test the "Grouping by" configuration. Only one field is allowed. Not all fields are persisted in alerts. If you select a field not part of the alert the case action will create a case where the grouping value is set to `unknow`. 3. Test the "Time window" feature. You can comment out the validation to test for shorter times. 4. Verify that the case action is experimental. 5. Verify that based on the rule type the case is created in the correct solution. 6. Verify that you cannot create a rule with the case action on the basic license. 7. Verify that the execution of the case action fails if you do not have permission for cases. Pending work on the system actions framework level to not allow users to create rules with system actions where they do not have permission. 8. Stress test the case action by creating multiple rules. ### Checklist Delete any items that are not applicable to this PR. - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [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 ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ## Release notes Automatically create cases when an alert is triggered. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: adcoelho <antonio.coelho@elastic.co> Co-authored-by: Janki Salvi <117571355+js-jankisalvi@users.noreply.github.com>
Summary
In this PR I started adding integration tests for the case action. This process revealed a couple of bugs which I fixed. Specifically this PR:
Blocked by: #178307
Flaky test runner: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5488
Checklist
Delete any items that are not applicable to this PR.
For maintainers