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] Write tests for filtering, sorting, pagination in the Rule Installation and Upgrade tables #166215

Open
Tracked by #179907
jpdjere opened this issue Sep 11, 2023 · 2 comments
Labels
Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. technical debt Improvement of the software architecture and operational architecture test-coverage issues & PRs for improving code test coverage

Comments

@jpdjere
Copy link
Contributor

jpdjere commented Sep 11, 2023

Epics: https://github.com/elastic/security-team/issues/1974 (internal), #174168

Summary

The test plan for the Rule Installation/Upgrade workflows includes the sections:

  • Rule installation workflow: filtering, sorting, pagination
  • Rule upgrade workflow: filtering, sorting, pagination
    which has still not been written.

Todo:

  1. Add the necessary scenarios to cover this functionality, deciding which types of tests are better suited for this job.
  2. Add those tests to the codebase.
@jpdjere jpdjere added triage_needed Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules labels Sep 11, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

jpdjere added a commit that referenced this issue Oct 17, 2023
… refactor (#165488)

Fixes: #148192

(Tick the two open checkboxes in that issue when merging this PR)

## Summary

This PR rewrites/refactors Cypress tests for the Installation and
Upgrade of Prebuilt Rules implemented in
#161687. Most of the changes here
address feedback received in that PR - answered those comments there.

- RBAC/Authorization: adds tests scenarios for users with full
privileges (happy path)
- Gets rid of huge util helpers such as
`assertRuleAvailableForInstallAndInstallOne` and rewrites test cases in
a more descriptive way, with step by step actions.
- Gets rid of complex logic in tests and their helpers - removing
if/else logic within them and removing optional flags passed to helpers.
- Fixes `bulkCreateRuleAssets` util and uses it in other helpers to
install multiple `security-rule` assets with a single bulk request to
ES.

Additionally: checked `installation_and_upgrade.md` test plan to make
sure it matches with the test in place. Added
[link](#166215) to a ticket for
a to-do task for the sections:
- Rule installation workflow: filtering, sorting, pagination
- Rule upgrade workflow: filtering, sorting, pagination

## Flaky test runner


~~https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3420~~
~~🟢~~

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3513

---------

Co-authored-by: kibanamachine <[email protected]>
jpdjere added a commit to jpdjere/kibana that referenced this issue Oct 17, 2023
… refactor (elastic#165488)

Fixes: elastic#148192

(Tick the two open checkboxes in that issue when merging this PR)

## Summary

This PR rewrites/refactors Cypress tests for the Installation and
Upgrade of Prebuilt Rules implemented in
elastic#161687. Most of the changes here
address feedback received in that PR - answered those comments there.

- RBAC/Authorization: adds tests scenarios for users with full
privileges (happy path)
- Gets rid of huge util helpers such as
`assertRuleAvailableForInstallAndInstallOne` and rewrites test cases in
a more descriptive way, with step by step actions.
- Gets rid of complex logic in tests and their helpers - removing
if/else logic within them and removing optional flags passed to helpers.
- Fixes `bulkCreateRuleAssets` util and uses it in other helpers to
install multiple `security-rule` assets with a single bulk request to
ES.

Additionally: checked `installation_and_upgrade.md` test plan to make
sure it matches with the test in place. Added
[link](elastic#166215) to a ticket for
a to-do task for the sections:
- Rule installation workflow: filtering, sorting, pagination
- Rule upgrade workflow: filtering, sorting, pagination

## Flaky test runner

~~https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3420~~
~~🟢~~

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3513

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 24c008b)

# Conflicts:
#	x-pack/test/security_solution_cypress/package.json
jpdjere added a commit that referenced this issue Oct 17, 2023
…ntation refactor (#165488) (#169129)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Security Solution] Install/Update Prebuilt Rules Test Implementation
refactor (#165488)](#165488)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT [{"author":{"name":"Juan Pablo
Djeredjian","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-10-17T11:05:49Z","message":"[Security
Solution] Install/Update Prebuilt Rules Test Implementation refactor
(#165488)\n\nFixes:
https://github.com/elastic/kibana/issues/148192\r\n\r\n(Tick the two
open checkboxes in that issue when merging this PR)\r\n\r\n##
Summary\r\n\r\nThis PR rewrites/refactors Cypress tests for the
Installation and\r\nUpgrade of Prebuilt Rules implemented
in\r\nhttps://github.com//pull/161687. Most of the changes
here\r\naddress feedback received in that PR - answered those comments
there.\r\n\r\n- RBAC/Authorization: adds tests scenarios for users with
full\r\nprivileges (happy path)\r\n- Gets rid of huge util helpers such
as\r\n`assertRuleAvailableForInstallAndInstallOne` and rewrites test
cases in\r\na more descriptive way, with step by step actions.\r\n- Gets
rid of complex logic in tests and their helpers - removing\r\nif/else
logic within them and removing optional flags passed to helpers.\r\n-
Fixes `bulkCreateRuleAssets` util and uses it in other helpers
to\r\ninstall multiple `security-rule` assets with a single bulk request
to\r\nES.\r\n\r\nAdditionally: checked `installation_and_upgrade.md`
test plan to make\r\nsure it matches with the test in place.
Added\r\n[link](#166215) to a
ticket for\r\na to-do task for the sections:\r\n- Rule installation
workflow: filtering, sorting, pagination\r\n- Rule upgrade workflow:
filtering, sorting, pagination\r\n\r\n## Flaky test
runner\r\n\r\n\r\n~~https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3420~~\r\n~~🟢~~\r\n\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3513\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"24c008b4c5026dd543f1b4aded94f3787bce5fb0","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["refactoring","release_note:skip","test-coverage","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","v8.11.0","v8.12.0"],"number":165488,"url":"https://github.com/elastic/kibana/pull/165488","mergeCommit":{"message":"[Security
Solution] Install/Update Prebuilt Rules Test Implementation refactor
(#165488)\n\nFixes:
https://github.com/elastic/kibana/issues/148192\r\n\r\n(Tick the two
open checkboxes in that issue when merging this PR)\r\n\r\n##
Summary\r\n\r\nThis PR rewrites/refactors Cypress tests for the
Installation and\r\nUpgrade of Prebuilt Rules implemented
in\r\nhttps://github.com//pull/161687. Most of the changes
here\r\naddress feedback received in that PR - answered those comments
there.\r\n\r\n- RBAC/Authorization: adds tests scenarios for users with
full\r\nprivileges (happy path)\r\n- Gets rid of huge util helpers such
as\r\n`assertRuleAvailableForInstallAndInstallOne` and rewrites test
cases in\r\na more descriptive way, with step by step actions.\r\n- Gets
rid of complex logic in tests and their helpers - removing\r\nif/else
logic within them and removing optional flags passed to helpers.\r\n-
Fixes `bulkCreateRuleAssets` util and uses it in other helpers
to\r\ninstall multiple `security-rule` assets with a single bulk request
to\r\nES.\r\n\r\nAdditionally: checked `installation_and_upgrade.md`
test plan to make\r\nsure it matches with the test in place.
Added\r\n[link](#166215) to a
ticket for\r\na to-do task for the sections:\r\n- Rule installation
workflow: filtering, sorting, pagination\r\n- Rule upgrade workflow:
filtering, sorting, pagination\r\n\r\n## Flaky test
runner\r\n\r\n\r\n~~https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3420~~\r\n~~🟢~~\r\n\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3513\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"24c008b4c5026dd543f1b4aded94f3787bce5fb0"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/165488","number":165488,"mergeCommit":{"message":"[Security
Solution] Install/Update Prebuilt Rules Test Implementation refactor
(#165488)\n\nFixes:
https://github.com/elastic/kibana/issues/148192\r\n\r\n(Tick the two
open checkboxes in that issue when merging this PR)\r\n\r\n##
Summary\r\n\r\nThis PR rewrites/refactors Cypress tests for the
Installation and\r\nUpgrade of Prebuilt Rules implemented
in\r\nhttps://github.com//pull/161687. Most of the changes
here\r\naddress feedback received in that PR - answered those comments
there.\r\n\r\n- RBAC/Authorization: adds tests scenarios for users with
full\r\nprivileges (happy path)\r\n- Gets rid of huge util helpers such
as\r\n`assertRuleAvailableForInstallAndInstallOne` and rewrites test
cases in\r\na more descriptive way, with step by step actions.\r\n- Gets
rid of complex logic in tests and their helpers - removing\r\nif/else
logic within them and removing optional flags passed to helpers.\r\n-
Fixes `bulkCreateRuleAssets` util and uses it in other helpers
to\r\ninstall multiple `security-rule` assets with a single bulk request
to\r\nES.\r\n\r\nAdditionally: checked `installation_and_upgrade.md`
test plan to make\r\nsure it matches with the test in place.
Added\r\n[link](#166215) to a
ticket for\r\na to-do task for the sections:\r\n- Rule installation
workflow: filtering, sorting, pagination\r\n- Rule upgrade workflow:
filtering, sorting, pagination\r\n\r\n## Flaky test
runner\r\n\r\n\r\n~~https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3420~~\r\n~~🟢~~\r\n\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3513\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"24c008b4c5026dd543f1b4aded94f3787bce5fb0"}}]}]
BACKPORT-->
@banderror banderror changed the title [Security Solution] Add tests to rule installation/update tables for filtering, sorting, pagination [Security Solution] Write tests for filtering, sorting, pagination in the Rule Installation and Upgrade tables Feb 23, 2024
@banderror banderror added technical debt Improvement of the software architecture and operational architecture test-coverage issues & PRs for improving code test coverage and removed triage_needed labels Feb 23, 2024
@banderror banderror removed their assignment Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. technical debt Improvement of the software architecture and operational architecture test-coverage issues & PRs for improving code test coverage
Projects
None yet
Development

No branches or pull requests

3 participants