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] Expand test coverage for performing rule field upgrades to all diffable fields #205339

Closed

Conversation

jpdjere
Copy link
Contributor

@jpdjere jpdjere commented Dec 31, 2024

Partially resolves: #202078

NOTE: This PR builds, refactors (and corrects parts of) #205217. Only the last commit in this PR (dbb5b23) actually addresses the description mentioned below. All others belong to #205217. This PR will probably need a rebase after #205217 is merged.

Summary

  • Refactors and expands upgrade/_perform integrations tests in ALL_RULES and SPECIFIC_RULES to cover all diffable fields.
  • Extracts out all mock data for tests used for integration tests of both upgrade/_review and upgrade/_perform endpoints into its own file.

Flaky test run

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

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

@jpdjere jpdjere changed the title Upgrade perfrom test enhancement [Security Solution] Expand test coverage for performing rule field upgrades to all diffable fields Dec 31, 2024
@jpdjere jpdjere self-assigned this Dec 31, 2024
@jpdjere jpdjere 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 Dec 31, 2024
@jpdjere jpdjere marked this pull request as ready for review December 31, 2024 19:48
@jpdjere jpdjere requested review from a team as code owners December 31, 2024 19:48
@jpdjere jpdjere requested a review from nikitaindik December 31, 2024 19:48
@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)

@jpdjere jpdjere requested a review from maximpn December 31, 2024 19:51
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] test/functional/apps/discover/group3/config.ts / discover/group3 discover request counts ES|QL mode should send no more than 2 search requests (documents + chart) on page load

Metrics [docs]

✅ unchanged

cc @jpdjere

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#7638

[❌] x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/configs/ess.config.ts: 75/100 tests passed.
[✅] x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/management/trial_license_complete_tier/configs/serverless.config.ts: 100/100 tests passed.

see run history

@banderror banderror removed the request for review from nikitaindik January 2, 2025 11:08
@maximpn maximpn marked this pull request as draft January 8, 2025 11:48
@elasticmachine
Copy link
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!

@maximpn
Copy link
Contributor

maximpn commented Feb 3, 2025

Closing in favor of #209260.

@maximpn maximpn closed this Feb 3, 2025
maximpn added a commit that referenced this pull request Feb 21, 2025
…t rule customization feature (#209260)

**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)).
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)
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
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)).
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 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Security Solution] Tests for prebuilt rule upgrade workflow
4 participants