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] Extend rule upgrade integration tests for prebuilt rule customization feature #209260

Merged
merged 21 commits into from
Feb 21, 2025

Conversation

maximpn
Copy link
Contributor

@maximpn maximpn commented Feb 3, 2025

Addresses: #202078
Partially implements test plan: #205922

Summary

This PR implements the Rule Upgrade test plan added in #205922 and #203331.

Details

Tests cover only enabled customization and organized in a following way

  • diffable_rule_fields folder contains per field tests. It focuses on DiffableRule* fields. Each field has rule preview and upgrade scenarios throughly covered. Assertion on stats are included in rule preview tests to make sure the maximum coverage with reasonable execution time. Diffable rule fields` tests were moved to a separate execution group to avoid exceeding execution limits.
  • preview_prebuilt_rules_upgrade.ts integration tests on /internal/prebuilt_rules/upgrade/_review endpoint. It uses only name and tags fields to minimize tests complexity. Basically it should be considered as smoke tests.
  • upgrade_prebuilt_rules integrations test on /internal/prebuilt_rules/upgrade/_perform endpoint. It uses only name and tags fields to minimize tests complexity. Basically it should be considered as smoke tests.

This PR supersedes #205217 and #205339.

  • DiffableRule was added in the scope of prebuilt rules customization epic to serve rule upgrades preview and performing upgrades. It represents slightly reorganized rule fields to simplify prebuilt rule upgrade workflow handling. There are utility functions transforming between RuleResponse and DiffableRule.

Flaky test runner

Flaky test runs for 100 iterations were successful (#209260 (comment) and #209260 (comment)).

@maximpn maximpn added test release_note:skip Skip the PR/issue when compiling release notes v9.0.0 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 area backport:version Backport to applied version labels v8.18.0 labels Feb 3, 2025
@maximpn maximpn self-assigned this Feb 3, 2025
@maximpn maximpn force-pushed the extend-rule-upgrade-integration-tests branch 3 times, most recently from 5cce9ae to 8d48535 Compare February 5, 2025 12:12
@maximpn maximpn marked this pull request as ready for review February 5, 2025 14:52
@maximpn maximpn requested review from a team as code owners February 5, 2025 14:52
@maximpn maximpn requested a review from xcrzx February 5, 2025 14:52
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

Copy link
Member

@jbudz jbudz left a comment

Choose a reason for hiding this comment

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

.buildkite/ftr_configs.yml LGTM

@maximpn maximpn force-pushed the extend-rule-upgrade-integration-tests branch from 1a3df74 to 48307fd Compare February 10, 2025 15:46
@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7849

[✅] x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/prebuilt_rule_customization/customization_enabled/diffable_rule_fields/type_specific_fields/configs/ess.config.ts: 100/100 tests passed.
[✅] x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/prebuilt_rule_customization/customization_enabled/diffable_rule_fields/type_specific_fields/configs/serverless.config.ts: 100/100 tests passed.

see run history

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7850

[✅] x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/prebuilt_rule_customization/customization_enabled/diffable_rule_fields/common_fields/configs/ess.config.ts: 100/100 tests passed.
[✅] x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/prebuilt_rule_customization/customization_enabled/diffable_rule_fields/common_fields/configs/serverless.config.ts: 100/100 tests passed.

see run history

@maximpn maximpn force-pushed the extend-rule-upgrade-integration-tests branch from b085204 to 5b4e589 Compare February 16, 2025 12:33
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @maximpn

Copy link
Contributor

@xcrzx xcrzx left a comment

Choose a reason for hiding this comment

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

Thank you for implementing my suggestions, @maximpn!

I looked through the code, and it’s LGTM, the reusable structures will make it much easier to keep the tests up to date with the implementation. I didn’t review the coverage due to the tight timelines we’re currently facing, but this is something we can revisit in later stages after the initial release. I think the PR is good to merge

@maximpn maximpn merged commit 4909770 into elastic:main Feb 21, 2025
10 checks passed
@maximpn maximpn deleted the extend-rule-upgrade-integration-tests branch February 21, 2025 11:11
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.18, 8.x, 9.0

https://github.com/elastic/kibana/actions/runs/13455601019

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 21, 2025
…t rule customization feature (elastic#209260)

**Addresses:** elastic#202078
**Partially implements test plan:** elastic#205922

## Summary

This PR implements the Rule Upgrade test plan added in elastic#205922 and elastic#203331.

## Details

Tests cover only enabled customization and organized in a following way

- `diffable_rule_fields` folder contains per field tests. It focuses on `DiffableRule`* fields. Each field has rule preview and upgrade scenarios throughly covered. Assertion on stats are included in rule preview tests to make sure the maximum coverage with reasonable execution time. **Diffable rule fields` tests were moved to a separate execution group to avoid exceeding execution limits.**
- `preview_prebuilt_rules_upgrade.ts` integration tests on `/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name` and `tags` fields to minimize tests complexity. Basically it should be considered as smoke tests.
- `upgrade_prebuilt_rules` integrations test on `/internal/prebuilt_rules/upgrade/_perform` endpoint.  It uses only `name` and `tags` fields to minimize tests complexity. Basically it should be considered as smoke tests.

This PR supersedes elastic#205217 and elastic#205339.

* `DiffableRule` was added in the scope of prebuilt rules customization epic to serve rule upgrades preview and performing upgrades. It represents slightly reorganized rule fields to simplify prebuilt rule upgrade workflow handling. There are utility functions transforming between `RuleResponse` and `DiffableRule`.

## Flaky test runner

Flaky test runs for 100 iterations were successful (elastic#209260 (comment) and elastic#209260 (comment)).

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

💔 Some backports could not be created

Status Branch Result
8.18 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.18:
- [Security Solution] [AI Assistant] Increase size of KB index entry search result (#210963)
- Clear gap filters after unmounting component (#211588)
- [Security Solution] [AI Assistant] Update copy of the citations tour. (#210398)
8.x Backport failed because of merge conflicts

You might need to backport the following PRs to 8.x:
- [Security Solution] [AI Assistant] Update copy of the citations tour. (#210398)
- [ES|QL][Lens] Keeps the chart configuration when possible (#210780)
- [Lens][Embeddable] Make UI react faster to click actions like create or edit (#210810)
- [Streams 🌊] Enable /api/streams/{id}/_group endpoints for GroupStreams (#210114)
9.0

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

Manual backport

To create the backport manually run:

node scripts/backport --pr 209260

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Feb 21, 2025
…rebuilt rule customization feature (#209260) (#212045)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Security Solution] Extend rule upgrade integration tests for
prebuilt rule customization feature
(#209260)](#209260)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"maxim.palenov@elastic.co"},"sourceCommit":{"committedDate":"2025-02-21T11:11:44Z","message":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization feature (#209260)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/202078\n**Partially implements
test plan:** https://github.com/elastic/kibana/pull/205922\n\n##
Summary\n\nThis PR implements the Rule Upgrade test plan added in
#205922 and
https://github.com/elastic/kibana/pull/203331.\n\n## Details\n\nTests
cover only enabled customization and organized in a following way\n\n-
`diffable_rule_fields` folder contains per field tests. It focuses on
`DiffableRule`* fields. Each field has rule preview and upgrade
scenarios throughly covered. Assertion on stats are included in rule
preview tests to make sure the maximum coverage with reasonable
execution time. **Diffable rule fields` tests were moved to a separate
execution group to avoid exceeding execution limits.**\n-
`preview_prebuilt_rules_upgrade.ts` integration tests on
`/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name`
and `tags` fields to minimize tests complexity. Basically it should be
considered as smoke tests.\n- `upgrade_prebuilt_rules` integrations test
on `/internal/prebuilt_rules/upgrade/_perform` endpoint. It uses only
`name` and `tags` fields to minimize tests complexity. Basically it
should be considered as smoke tests.\n\nThis PR supersedes
#205217 and
https://github.com/elastic/kibana/pull/205339.\n\n* `DiffableRule` was
added in the scope of prebuilt rules customization epic to serve rule
upgrades preview and performing upgrades. It represents slightly
reorganized rule fields to simplify prebuilt rule upgrade workflow
handling. There are utility functions transforming between
`RuleResponse` and `DiffableRule`.\n\n## Flaky test runner\n\nFlaky test
runs for 100 iterations were successful
(#209260 (comment)
and
https://github.com/elastic/kibana/pull/209260#issuecomment-2649627389).","sha":"4909770664a97f97bc38adc91dc852b5b1e6abf7","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","v9.0.0","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization
feature","number":209260,"url":"https://github.com/elastic/kibana/pull/209260","mergeCommit":{"message":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization feature (#209260)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/202078\n**Partially implements
test plan:** https://github.com/elastic/kibana/pull/205922\n\n##
Summary\n\nThis PR implements the Rule Upgrade test plan added in
#205922 and
https://github.com/elastic/kibana/pull/203331.\n\n## Details\n\nTests
cover only enabled customization and organized in a following way\n\n-
`diffable_rule_fields` folder contains per field tests. It focuses on
`DiffableRule`* fields. Each field has rule preview and upgrade
scenarios throughly covered. Assertion on stats are included in rule
preview tests to make sure the maximum coverage with reasonable
execution time. **Diffable rule fields` tests were moved to a separate
execution group to avoid exceeding execution limits.**\n-
`preview_prebuilt_rules_upgrade.ts` integration tests on
`/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name`
and `tags` fields to minimize tests complexity. Basically it should be
considered as smoke tests.\n- `upgrade_prebuilt_rules` integrations test
on `/internal/prebuilt_rules/upgrade/_perform` endpoint. It uses only
`name` and `tags` fields to minimize tests complexity. Basically it
should be considered as smoke tests.\n\nThis PR supersedes
#205217 and
https://github.com/elastic/kibana/pull/205339.\n\n* `DiffableRule` was
added in the scope of prebuilt rules customization epic to serve rule
upgrades preview and performing upgrades. It represents slightly
reorganized rule fields to simplify prebuilt rule upgrade workflow
handling. There are utility functions transforming between
`RuleResponse` and `DiffableRule`.\n\n## Flaky test runner\n\nFlaky test
runs for 100 iterations were successful
(#209260 (comment)
and
https://github.com/elastic/kibana/pull/209260#issuecomment-2649627389).","sha":"4909770664a97f97bc38adc91dc852b5b1e6abf7"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/209260","number":209260,"mergeCommit":{"message":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization feature (#209260)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/202078\n**Partially implements
test plan:** https://github.com/elastic/kibana/pull/205922\n\n##
Summary\n\nThis PR implements the Rule Upgrade test plan added in
#205922 and
https://github.com/elastic/kibana/pull/203331.\n\n## Details\n\nTests
cover only enabled customization and organized in a following way\n\n-
`diffable_rule_fields` folder contains per field tests. It focuses on
`DiffableRule`* fields. Each field has rule preview and upgrade
scenarios throughly covered. Assertion on stats are included in rule
preview tests to make sure the maximum coverage with reasonable
execution time. **Diffable rule fields` tests were moved to a separate
execution group to avoid exceeding execution limits.**\n-
`preview_prebuilt_rules_upgrade.ts` integration tests on
`/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name`
and `tags` fields to minimize tests complexity. Basically it should be
considered as smoke tests.\n- `upgrade_prebuilt_rules` integrations test
on `/internal/prebuilt_rules/upgrade/_perform` endpoint. It uses only
`name` and `tags` fields to minimize tests complexity. Basically it
should be considered as smoke tests.\n\nThis PR supersedes
#205217 and
https://github.com/elastic/kibana/pull/205339.\n\n* `DiffableRule` was
added in the scope of prebuilt rules customization epic to serve rule
upgrades preview and performing upgrades. It represents slightly
reorganized rule fields to simplify prebuilt rule upgrade workflow
handling. There are utility functions transforming between
`RuleResponse` and `DiffableRule`.\n\n## Flaky test runner\n\nFlaky test
runs for 100 iterations were successful
(#209260 (comment)
and
https://github.com/elastic/kibana/pull/209260#issuecomment-2649627389).","sha":"4909770664a97f97bc38adc91dc852b5b1e6abf7"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
@banderror
Copy link
Contributor

@maximpn Did you notice that two of the backports failed?

@maximpn
Copy link
Contributor Author

maximpn commented Feb 24, 2025

💚 All backports created successfully

Status Branch Result
8.x
8.18

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

Questions ?

Please refer to the Backport tool documentation

maximpn added a commit to maximpn/kibana that referenced this pull request Feb 24, 2025
…t rule customization feature (elastic#209260)

**Addresses:** elastic#202078
**Partially implements test plan:** elastic#205922

## Summary

This PR implements the Rule Upgrade test plan added in elastic#205922 and elastic#203331.

## Details

Tests cover only enabled customization and organized in a following way

- `diffable_rule_fields` folder contains per field tests. It focuses on `DiffableRule`* fields. Each field has rule preview and upgrade scenarios throughly covered. Assertion on stats are included in rule preview tests to make sure the maximum coverage with reasonable execution time. **Diffable rule fields` tests were moved to a separate execution group to avoid exceeding execution limits.**
- `preview_prebuilt_rules_upgrade.ts` integration tests on `/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name` and `tags` fields to minimize tests complexity. Basically it should be considered as smoke tests.
- `upgrade_prebuilt_rules` integrations test on `/internal/prebuilt_rules/upgrade/_perform` endpoint.  It uses only `name` and `tags` fields to minimize tests complexity. Basically it should be considered as smoke tests.

This PR supersedes elastic#205217 and elastic#205339.

* `DiffableRule` was added in the scope of prebuilt rules customization epic to serve rule upgrades preview and performing upgrades. It represents slightly reorganized rule fields to simplify prebuilt rule upgrade workflow handling. There are utility functions transforming between `RuleResponse` and `DiffableRule`.

## Flaky test runner

Flaky test runs for 100 iterations were successful (elastic#209260 (comment) and elastic#209260 (comment)).

(cherry picked from commit 4909770)

# Conflicts:
#	x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/prebuilt_rule_customization/customization_enabled/upgrade_perform_prebuilt_rules.all_rules_mode.ts
#	x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/prebuilt_rule_customization/customization_enabled/upgrade_perform_prebuilt_rules.specific_rules_mode.ts
maximpn added a commit that referenced this pull request Feb 24, 2025
…rebuilt rule customization feature (#209260) (#212282)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution] Extend rule upgrade integration tests for
prebuilt rule customization feature
(#209260)](#209260)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"maxim.palenov@elastic.co"},"sourceCommit":{"committedDate":"2025-02-21T11:11:44Z","message":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization feature (#209260)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/202078\n**Partially implements
test plan:** https://github.com/elastic/kibana/pull/205922\n\n##
Summary\n\nThis PR implements the Rule Upgrade test plan added in
#205922 and
https://github.com/elastic/kibana/pull/203331.\n\n## Details\n\nTests
cover only enabled customization and organized in a following way\n\n-
`diffable_rule_fields` folder contains per field tests. It focuses on
`DiffableRule`* fields. Each field has rule preview and upgrade
scenarios throughly covered. Assertion on stats are included in rule
preview tests to make sure the maximum coverage with reasonable
execution time. **Diffable rule fields` tests were moved to a separate
execution group to avoid exceeding execution limits.**\n-
`preview_prebuilt_rules_upgrade.ts` integration tests on
`/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name`
and `tags` fields to minimize tests complexity. Basically it should be
considered as smoke tests.\n- `upgrade_prebuilt_rules` integrations test
on `/internal/prebuilt_rules/upgrade/_perform` endpoint. It uses only
`name` and `tags` fields to minimize tests complexity. Basically it
should be considered as smoke tests.\n\nThis PR supersedes
#205217 and
https://github.com/elastic/kibana/pull/205339.\n\n* `DiffableRule` was
added in the scope of prebuilt rules customization epic to serve rule
upgrades preview and performing upgrades. It represents slightly
reorganized rule fields to simplify prebuilt rule upgrade workflow
handling. There are utility functions transforming between
`RuleResponse` and `DiffableRule`.\n\n## Flaky test runner\n\nFlaky test
runs for 100 iterations were successful
(#209260 (comment)
and
https://github.com/elastic/kibana/pull/209260#issuecomment-2649627389).","sha":"4909770664a97f97bc38adc91dc852b5b1e6abf7","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","v9.0.0","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization
feature","number":209260,"url":"https://github.com/elastic/kibana/pull/209260","mergeCommit":{"message":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization feature (#209260)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/202078\n**Partially implements
test plan:** https://github.com/elastic/kibana/pull/205922\n\n##
Summary\n\nThis PR implements the Rule Upgrade test plan added in
#205922 and
https://github.com/elastic/kibana/pull/203331.\n\n## Details\n\nTests
cover only enabled customization and organized in a following way\n\n-
`diffable_rule_fields` folder contains per field tests. It focuses on
`DiffableRule`* fields. Each field has rule preview and upgrade
scenarios throughly covered. Assertion on stats are included in rule
preview tests to make sure the maximum coverage with reasonable
execution time. **Diffable rule fields` tests were moved to a separate
execution group to avoid exceeding execution limits.**\n-
`preview_prebuilt_rules_upgrade.ts` integration tests on
`/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name`
and `tags` fields to minimize tests complexity. Basically it should be
considered as smoke tests.\n- `upgrade_prebuilt_rules` integrations test
on `/internal/prebuilt_rules/upgrade/_perform` endpoint. It uses only
`name` and `tags` fields to minimize tests complexity. Basically it
should be considered as smoke tests.\n\nThis PR supersedes
#205217 and
https://github.com/elastic/kibana/pull/205339.\n\n* `DiffableRule` was
added in the scope of prebuilt rules customization epic to serve rule
upgrades preview and performing upgrades. It represents slightly
reorganized rule fields to simplify prebuilt rule upgrade workflow
handling. There are utility functions transforming between
`RuleResponse` and `DiffableRule`.\n\n## Flaky test runner\n\nFlaky test
runs for 100 iterations were successful
(#209260 (comment)
and
https://github.com/elastic/kibana/pull/209260#issuecomment-2649627389).","sha":"4909770664a97f97bc38adc91dc852b5b1e6abf7"}},"sourceBranch":"main","suggestedTargetBranches":["8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/212045","number":212045,"state":"MERGED","mergeCommit":{"sha":"5e5989ab91c571225a3bba0fa8affd0321312aee","message":"[9.0]
[Security Solution] Extend rule upgrade integration tests for prebuilt
rule customization feature (#209260) (#212045)\n\n# Backport\n\nThis
will backport the following commits from `main` to `9.0`:\n- [[Security
Solution] Extend rule upgrade integration tests for\nprebuilt rule
customization
feature\n(#209260)](https://github.com/elastic/kibana/pull/209260)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Maxim Palenov
<maxim.palenov@elastic.co>"}},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/209260","number":209260,"mergeCommit":{"message":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization feature (#209260)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/202078\n**Partially implements
test plan:** https://github.com/elastic/kibana/pull/205922\n\n##
Summary\n\nThis PR implements the Rule Upgrade test plan added in
#205922 and
https://github.com/elastic/kibana/pull/203331.\n\n## Details\n\nTests
cover only enabled customization and organized in a following way\n\n-
`diffable_rule_fields` folder contains per field tests. It focuses on
`DiffableRule`* fields. Each field has rule preview and upgrade
scenarios throughly covered. Assertion on stats are included in rule
preview tests to make sure the maximum coverage with reasonable
execution time. **Diffable rule fields` tests were moved to a separate
execution group to avoid exceeding execution limits.**\n-
`preview_prebuilt_rules_upgrade.ts` integration tests on
`/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name`
and `tags` fields to minimize tests complexity. Basically it should be
considered as smoke tests.\n- `upgrade_prebuilt_rules` integrations test
on `/internal/prebuilt_rules/upgrade/_perform` endpoint. It uses only
`name` and `tags` fields to minimize tests complexity. Basically it
should be considered as smoke tests.\n\nThis PR supersedes
#205217 and
https://github.com/elastic/kibana/pull/205339.\n\n* `DiffableRule` was
added in the scope of prebuilt rules customization epic to serve rule
upgrades preview and performing upgrades. It represents slightly
reorganized rule fields to simplify prebuilt rule upgrade workflow
handling. There are utility functions transforming between
`RuleResponse` and `DiffableRule`.\n\n## Flaky test runner\n\nFlaky test
runs for 100 iterations were successful
(#209260 (comment)
and
https://github.com/elastic/kibana/pull/209260#issuecomment-2649627389).","sha":"4909770664a97f97bc38adc91dc852b5b1e6abf7"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
maximpn added a commit that referenced this pull request Feb 24, 2025
…prebuilt rule customization feature (#209260) (#212283)

# Backport

This will backport the following commits from `main` to `8.18`:
- [[Security Solution] Extend rule upgrade integration tests for
prebuilt rule customization feature
(#209260)](#209260)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"maxim.palenov@elastic.co"},"sourceCommit":{"committedDate":"2025-02-21T11:11:44Z","message":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization feature (#209260)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/202078\n**Partially implements
test plan:** https://github.com/elastic/kibana/pull/205922\n\n##
Summary\n\nThis PR implements the Rule Upgrade test plan added in
#205922 and
https://github.com/elastic/kibana/pull/203331.\n\n## Details\n\nTests
cover only enabled customization and organized in a following way\n\n-
`diffable_rule_fields` folder contains per field tests. It focuses on
`DiffableRule`* fields. Each field has rule preview and upgrade
scenarios throughly covered. Assertion on stats are included in rule
preview tests to make sure the maximum coverage with reasonable
execution time. **Diffable rule fields` tests were moved to a separate
execution group to avoid exceeding execution limits.**\n-
`preview_prebuilt_rules_upgrade.ts` integration tests on
`/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name`
and `tags` fields to minimize tests complexity. Basically it should be
considered as smoke tests.\n- `upgrade_prebuilt_rules` integrations test
on `/internal/prebuilt_rules/upgrade/_perform` endpoint. It uses only
`name` and `tags` fields to minimize tests complexity. Basically it
should be considered as smoke tests.\n\nThis PR supersedes
#205217 and
https://github.com/elastic/kibana/pull/205339.\n\n* `DiffableRule` was
added in the scope of prebuilt rules customization epic to serve rule
upgrades preview and performing upgrades. It represents slightly
reorganized rule fields to simplify prebuilt rule upgrade workflow
handling. There are utility functions transforming between
`RuleResponse` and `DiffableRule`.\n\n## Flaky test runner\n\nFlaky test
runs for 100 iterations were successful
(#209260 (comment)
and
https://github.com/elastic/kibana/pull/209260#issuecomment-2649627389).","sha":"4909770664a97f97bc38adc91dc852b5b1e6abf7","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","v9.0.0","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization
feature","number":209260,"url":"https://github.com/elastic/kibana/pull/209260","mergeCommit":{"message":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization feature (#209260)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/202078\n**Partially implements
test plan:** https://github.com/elastic/kibana/pull/205922\n\n##
Summary\n\nThis PR implements the Rule Upgrade test plan added in
#205922 and
https://github.com/elastic/kibana/pull/203331.\n\n## Details\n\nTests
cover only enabled customization and organized in a following way\n\n-
`diffable_rule_fields` folder contains per field tests. It focuses on
`DiffableRule`* fields. Each field has rule preview and upgrade
scenarios throughly covered. Assertion on stats are included in rule
preview tests to make sure the maximum coverage with reasonable
execution time. **Diffable rule fields` tests were moved to a separate
execution group to avoid exceeding execution limits.**\n-
`preview_prebuilt_rules_upgrade.ts` integration tests on
`/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name`
and `tags` fields to minimize tests complexity. Basically it should be
considered as smoke tests.\n- `upgrade_prebuilt_rules` integrations test
on `/internal/prebuilt_rules/upgrade/_perform` endpoint. It uses only
`name` and `tags` fields to minimize tests complexity. Basically it
should be considered as smoke tests.\n\nThis PR supersedes
#205217 and
https://github.com/elastic/kibana/pull/205339.\n\n* `DiffableRule` was
added in the scope of prebuilt rules customization epic to serve rule
upgrades preview and performing upgrades. It represents slightly
reorganized rule fields to simplify prebuilt rule upgrade workflow
handling. There are utility functions transforming between
`RuleResponse` and `DiffableRule`.\n\n## Flaky test runner\n\nFlaky test
runs for 100 iterations were successful
(#209260 (comment)
and
https://github.com/elastic/kibana/pull/209260#issuecomment-2649627389).","sha":"4909770664a97f97bc38adc91dc852b5b1e6abf7"}},"sourceBranch":"main","suggestedTargetBranches":["8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/212045","number":212045,"state":"MERGED","mergeCommit":{"sha":"5e5989ab91c571225a3bba0fa8affd0321312aee","message":"[9.0]
[Security Solution] Extend rule upgrade integration tests for prebuilt
rule customization feature (#209260) (#212045)\n\n# Backport\n\nThis
will backport the following commits from `main` to `9.0`:\n- [[Security
Solution] Extend rule upgrade integration tests for\nprebuilt rule
customization
feature\n(#209260)](https://github.com/elastic/kibana/pull/209260)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Maxim Palenov
<maxim.palenov@elastic.co>"}},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/209260","number":209260,"mergeCommit":{"message":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization feature (#209260)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/202078\n**Partially implements
test plan:** https://github.com/elastic/kibana/pull/205922\n\n##
Summary\n\nThis PR implements the Rule Upgrade test plan added in
#205922 and
https://github.com/elastic/kibana/pull/203331.\n\n## Details\n\nTests
cover only enabled customization and organized in a following way\n\n-
`diffable_rule_fields` folder contains per field tests. It focuses on
`DiffableRule`* fields. Each field has rule preview and upgrade
scenarios throughly covered. Assertion on stats are included in rule
preview tests to make sure the maximum coverage with reasonable
execution time. **Diffable rule fields` tests were moved to a separate
execution group to avoid exceeding execution limits.**\n-
`preview_prebuilt_rules_upgrade.ts` integration tests on
`/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name`
and `tags` fields to minimize tests complexity. Basically it should be
considered as smoke tests.\n- `upgrade_prebuilt_rules` integrations test
on `/internal/prebuilt_rules/upgrade/_perform` endpoint. It uses only
`name` and `tags` fields to minimize tests complexity. Basically it
should be considered as smoke tests.\n\nThis PR supersedes
#205217 and
https://github.com/elastic/kibana/pull/205339.\n\n* `DiffableRule` was
added in the scope of prebuilt rules customization epic to serve rule
upgrades preview and performing upgrades. It represents slightly
reorganized rule fields to simplify prebuilt rule upgrade workflow
handling. There are utility functions transforming between
`RuleResponse` and `DiffableRule`.\n\n## Flaky test runner\n\nFlaky test
runs for 100 iterations were successful
(#209260 (comment)
and
https://github.com/elastic/kibana/pull/209260#issuecomment-2649627389).","sha":"4909770664a97f97bc38adc91dc852b5b1e6abf7"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
JoseLuisGJ pushed a commit to JoseLuisGJ/kibana that referenced this pull request Feb 27, 2025
…t rule customization feature (elastic#209260)

**Addresses:** elastic#202078
**Partially implements test plan:** elastic#205922

## Summary

This PR implements the Rule Upgrade test plan added in elastic#205922 and elastic#203331.

## Details

Tests cover only enabled customization and organized in a following way

- `diffable_rule_fields` folder contains per field tests. It focuses on `DiffableRule`* fields. Each field has rule preview and upgrade scenarios throughly covered. Assertion on stats are included in rule preview tests to make sure the maximum coverage with reasonable execution time. **Diffable rule fields` tests were moved to a separate execution group to avoid exceeding execution limits.**
- `preview_prebuilt_rules_upgrade.ts` integration tests on `/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name` and `tags` fields to minimize tests complexity. Basically it should be considered as smoke tests.
- `upgrade_prebuilt_rules` integrations test on `/internal/prebuilt_rules/upgrade/_perform` endpoint.  It uses only `name` and `tags` fields to minimize tests complexity. Basically it should be considered as smoke tests.

This PR supersedes elastic#205217 and elastic#205339.

* `DiffableRule` was added in the scope of prebuilt rules customization epic to serve rule upgrades preview and performing upgrades. It represents slightly reorganized rule fields to simplify prebuilt rule upgrade workflow handling. There are utility functions transforming between `RuleResponse` and `DiffableRule`.

## Flaky test runner

Flaky test runs for 100 iterations were successful (elastic#209260 (comment) and elastic#209260 (comment)).
SoniaSanzV pushed a commit to SoniaSanzV/kibana that referenced this pull request Mar 4, 2025
…rebuilt rule customization feature (elastic#209260) (elastic#212282)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution] Extend rule upgrade integration tests for
prebuilt rule customization feature
(elastic#209260)](elastic#209260)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"maxim.palenov@elastic.co"},"sourceCommit":{"committedDate":"2025-02-21T11:11:44Z","message":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization feature (elastic#209260)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/202078\n**Partially implements
test plan:** https://github.com/elastic/kibana/pull/205922\n\n##
Summary\n\nThis PR implements the Rule Upgrade test plan added in
elastic#205922 and
https://github.com/elastic/kibana/pull/203331.\n\n## Details\n\nTests
cover only enabled customization and organized in a following way\n\n-
`diffable_rule_fields` folder contains per field tests. It focuses on
`DiffableRule`* fields. Each field has rule preview and upgrade
scenarios throughly covered. Assertion on stats are included in rule
preview tests to make sure the maximum coverage with reasonable
execution time. **Diffable rule fields` tests were moved to a separate
execution group to avoid exceeding execution limits.**\n-
`preview_prebuilt_rules_upgrade.ts` integration tests on
`/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name`
and `tags` fields to minimize tests complexity. Basically it should be
considered as smoke tests.\n- `upgrade_prebuilt_rules` integrations test
on `/internal/prebuilt_rules/upgrade/_perform` endpoint. It uses only
`name` and `tags` fields to minimize tests complexity. Basically it
should be considered as smoke tests.\n\nThis PR supersedes
elastic#205217 and
https://github.com/elastic/kibana/pull/205339.\n\n* `DiffableRule` was
added in the scope of prebuilt rules customization epic to serve rule
upgrades preview and performing upgrades. It represents slightly
reorganized rule fields to simplify prebuilt rule upgrade workflow
handling. There are utility functions transforming between
`RuleResponse` and `DiffableRule`.\n\n## Flaky test runner\n\nFlaky test
runs for 100 iterations were successful
(elastic#209260 (comment)
and
https://github.com/elastic/kibana/pull/209260#issuecomment-2649627389).","sha":"4909770664a97f97bc38adc91dc852b5b1e6abf7","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","v9.0.0","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization
feature","number":209260,"url":"https://github.com/elastic/kibana/pull/209260","mergeCommit":{"message":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization feature (elastic#209260)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/202078\n**Partially implements
test plan:** https://github.com/elastic/kibana/pull/205922\n\n##
Summary\n\nThis PR implements the Rule Upgrade test plan added in
elastic#205922 and
https://github.com/elastic/kibana/pull/203331.\n\n## Details\n\nTests
cover only enabled customization and organized in a following way\n\n-
`diffable_rule_fields` folder contains per field tests. It focuses on
`DiffableRule`* fields. Each field has rule preview and upgrade
scenarios throughly covered. Assertion on stats are included in rule
preview tests to make sure the maximum coverage with reasonable
execution time. **Diffable rule fields` tests were moved to a separate
execution group to avoid exceeding execution limits.**\n-
`preview_prebuilt_rules_upgrade.ts` integration tests on
`/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name`
and `tags` fields to minimize tests complexity. Basically it should be
considered as smoke tests.\n- `upgrade_prebuilt_rules` integrations test
on `/internal/prebuilt_rules/upgrade/_perform` endpoint. It uses only
`name` and `tags` fields to minimize tests complexity. Basically it
should be considered as smoke tests.\n\nThis PR supersedes
elastic#205217 and
https://github.com/elastic/kibana/pull/205339.\n\n* `DiffableRule` was
added in the scope of prebuilt rules customization epic to serve rule
upgrades preview and performing upgrades. It represents slightly
reorganized rule fields to simplify prebuilt rule upgrade workflow
handling. There are utility functions transforming between
`RuleResponse` and `DiffableRule`.\n\n## Flaky test runner\n\nFlaky test
runs for 100 iterations were successful
(elastic#209260 (comment)
and
https://github.com/elastic/kibana/pull/209260#issuecomment-2649627389).","sha":"4909770664a97f97bc38adc91dc852b5b1e6abf7"}},"sourceBranch":"main","suggestedTargetBranches":["8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/212045","number":212045,"state":"MERGED","mergeCommit":{"sha":"5e5989ab91c571225a3bba0fa8affd0321312aee","message":"[9.0]
[Security Solution] Extend rule upgrade integration tests for prebuilt
rule customization feature (elastic#209260) (elastic#212045)\n\n# Backport\n\nThis
will backport the following commits from `main` to `9.0`:\n- [[Security
Solution] Extend rule upgrade integration tests for\nprebuilt rule
customization
feature\n(elastic#209260)](https://github.com/elastic/kibana/pull/209260)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Maxim Palenov
<maxim.palenov@elastic.co>"}},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/209260","number":209260,"mergeCommit":{"message":"[Security
Solution] Extend rule upgrade integration tests for prebuilt rule
customization feature (elastic#209260)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/202078\n**Partially implements
test plan:** https://github.com/elastic/kibana/pull/205922\n\n##
Summary\n\nThis PR implements the Rule Upgrade test plan added in
elastic#205922 and
https://github.com/elastic/kibana/pull/203331.\n\n## Details\n\nTests
cover only enabled customization and organized in a following way\n\n-
`diffable_rule_fields` folder contains per field tests. It focuses on
`DiffableRule`* fields. Each field has rule preview and upgrade
scenarios throughly covered. Assertion on stats are included in rule
preview tests to make sure the maximum coverage with reasonable
execution time. **Diffable rule fields` tests were moved to a separate
execution group to avoid exceeding execution limits.**\n-
`preview_prebuilt_rules_upgrade.ts` integration tests on
`/internal/prebuilt_rules/upgrade/_review` endpoint. It uses only `name`
and `tags` fields to minimize tests complexity. Basically it should be
considered as smoke tests.\n- `upgrade_prebuilt_rules` integrations test
on `/internal/prebuilt_rules/upgrade/_perform` endpoint. It uses only
`name` and `tags` fields to minimize tests complexity. Basically it
should be considered as smoke tests.\n\nThis PR supersedes
elastic#205217 and
https://github.com/elastic/kibana/pull/205339.\n\n* `DiffableRule` was
added in the scope of prebuilt rules customization epic to serve rule
upgrades preview and performing upgrades. It represents slightly
reorganized rule fields to simplify prebuilt rule upgrade workflow
handling. There are utility functions transforming between
`RuleResponse` and `DiffableRule`.\n\n## Flaky test runner\n\nFlaky test
runs for 100 iterations were successful
(elastic#209260 (comment)
and
https://github.com/elastic/kibana/pull/209260#issuecomment-2649627389).","sha":"4909770664a97f97bc38adc91dc852b5b1e6abf7"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules area release_note:skip Skip the PR/issue when compiling release notes 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. test v8.18.0 v8.19.0 v9.0.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants