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

[SecuritySolution][Endpoint] Update Responder command definition test so that it fails when new commands are added #187491

Conversation

ashokaditya
Copy link
Member

@ashokaditya ashokaditya commented Jul 3, 2024

Summary

Updates test so that it fails whenever we add a introduce a new responder command.

Checklist

@ashokaditya ashokaditya added release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution OLM Sprint v8.15.0 v8.16.0 labels Jul 3, 2024
@ashokaditya ashokaditya self-assigned this Jul 3, 2024
@ashokaditya
Copy link
Member Author

/ci

@ashokaditya ashokaditya requested a review from paul-tavares July 3, 2024 14:54
@ashokaditya ashokaditya force-pushed the task/dw-update-responder-command-def-tests branch 2 times, most recently from 29445aa to 20d5f90 Compare July 4, 2024 10:32
@ashokaditya ashokaditya force-pushed the task/dw-update-responder-command-def-tests branch from 20d5f90 to 81ff637 Compare July 4, 2024 10:33
@ashokaditya ashokaditya marked this pull request as ready for review July 4, 2024 10:33
@ashokaditya ashokaditya requested review from a team as code owners July 4, 2024 10:33
@ashokaditya ashokaditya requested a review from pzl July 4, 2024 10:33
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-defend-workflows (Team:Defend Workflows)

@ashokaditya ashokaditya requested a review from gergoabraham July 4, 2024 10:33
Copy link
Contributor

@gergoabraham gergoabraham left a comment

Choose a reason for hiding this comment

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

hey @ashokaditya,

could you explain how the test would fail when new commands are added? when a new command is added, isn't it added to the UI and also to CONSOLE_RESPONSE_ACTION_COMMANDS the same time, so the test won't fail? or am i wrong here?
(i'm not really familiar with response actions, but i'd like to understand before approving :) )

@ashokaditya
Copy link
Member Author

ashokaditya commented Jul 4, 2024

hey @ashokaditya,

could you explain how the test would fail when new commands are added? when a new command is added, isn't it added to the UI and also to CONSOLE_RESPONSE_ACTION_COMMANDS the same time, so the test won't fail? or am i wrong here? (i'm not really familiar with response actions, but i'd like to understand before approving :) )

No worries. Thanks for asking. So we add response console commands within console_commands_definition.ts. You can see the list of commands is a CommandDefinition[] type and is not the same as CONSOLE_RESPONSE_ACTION_COMMANDS. With this test change we are going to iterate over CONSOLE_RESPONSE_ACTION_COMMANDS and compare if the commands shown in the help panel are from the expected list.

As a test, on your main branch, you can try adding any string to CONSOLE_RESPONSE_ACTION_COMMANDS and then run the integration test console_commands_definition.test.tsx by running

yarn test:jest_integration --config x-pack/plugins/security_solution/jest.integration.config.js x-pack/plugins/security_solution/public/management/components/endpoint_responder/lib/integration_tests/console_commands_definition.test.tsx

You would notice that the tests pass, which should not be the case.

Note: I updated the test again as when I ran the test myself as above the test was not failing.

@ashokaditya ashokaditya requested a review from gergoabraham July 4, 2024 14:46
Copy link
Contributor

@gergoabraham gergoabraham left a comment

Choose a reason for hiding this comment

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

thanks @ashokaditya for the explanation! 🚀

@ashokaditya ashokaditya merged commit fffc684 into elastic:main Jul 5, 2024
38 checks passed
@ashokaditya ashokaditya deleted the task/dw-update-responder-command-def-tests branch July 5, 2024 14:51
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 5, 2024
… so that it fails when new commands are added (elastic#187491)

## Summary

Updates test so that it fails whenever we add a introduce a new
responder command.

### Checklist
- [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

(cherry picked from commit fffc684)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.15

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 Jul 10, 2024
…on test so that it fails when new commands are added (#187491) (#187689)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[SecuritySolution][Endpoint] Update Responder command definition test
so that it fails when new commands are added
(#187491)](#187491)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Ash","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-07-05T14:51:39Z","message":"[SecuritySolution][Endpoint]
Update Responder command definition test so that it fails when new
commands are added (#187491)\n\n## Summary\r\n\r\nUpdates test so that
it fails whenever we add a introduce a new\r\nresponder
command.\r\n\r\n### Checklist\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"fffc684d4e489490ede9726ffe0792206a14be34","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Defend
Workflows","OLM
Sprint","v8.15.0","v8.16.0"],"title":"[SecuritySolution][Endpoint]
Update Responder command definition test so that it fails when new
commands are
added","number":187491,"url":"https://github.com/elastic/kibana/pull/187491","mergeCommit":{"message":"[SecuritySolution][Endpoint]
Update Responder command definition test so that it fails when new
commands are added (#187491)\n\n## Summary\r\n\r\nUpdates test so that
it fails whenever we add a introduce a new\r\nresponder
command.\r\n\r\n### Checklist\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"fffc684d4e489490ede9726ffe0792206a14be34"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/187491","number":187491,"mergeCommit":{"message":"[SecuritySolution][Endpoint]
Update Responder command definition test so that it fails when new
commands are added (#187491)\n\n## Summary\r\n\r\nUpdates test so that
it fails whenever we add a introduce a new\r\nresponder
command.\r\n\r\n### Checklist\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"fffc684d4e489490ede9726ffe0792206a14be34"}}]}]
BACKPORT-->

Co-authored-by: Ash <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OLM Sprint release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.15.0 v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants