Skip to content

Conversation

@maximpn
Copy link
Contributor

@maximpn maximpn commented Aug 2, 2025

Resolves: #228844
Resolves: #229297
Resolves: #229490
Relates to: #230363

Summary

This PR fixes integration tests flakiness caused by a race condition with the Fleet setup logic.

Details

Investigation of the related flaky integration tests has revealed that Fleet's setup logic (usually executed upon Kibana startup) performs installed packages re-installation. However, Fleet allows to make API calls like install a package. Subsequently some package (for example security_detection_engine) might be installed before Fleet's setup logic completed. In particular a package installation API call leads to creation of package installation SO which is read by Fleet's setup logic. So Fleet "thinks" the package was installed some time ago and required re-installation.

There is a Fleet bug ticket describing this issue.

This fix in this PR just wait for Fleet plugin to finish setup before running integration tests for Rule Management area.

Flaky test runner

@maximpn maximpn self-assigned this Aug 2, 2025
@maximpn maximpn added test release_note:skip Skip the PR/issue when compiling release notes 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 v9.2.0 v9.0.5 v9.1.1 v8.18.5 v8.19.1 labels Aug 2, 2025
@maximpn maximpn force-pushed the fix-flakiness-in-air-gapped-integration-tests branch from daa6778 to 3e4355b Compare August 4, 2025 07:46
@elastic elastic deleted a comment from kibanamachine Aug 4, 2025
@elastic elastic deleted a comment from kibanamachine Aug 4, 2025
@elastic elastic deleted a comment from kibanamachine Aug 4, 2025
@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

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

[✅] x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/configs/edge_cases/ess_air_gapped_with_bundled_packages.config.ts: 200/200 tests passed.

see run history

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

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

[✅] x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/configs/edge_cases/ess_air_gapped_with_bundled_packages.config.ts: 200/200 tests passed.

see run history

@maximpn maximpn force-pushed the fix-flakiness-in-air-gapped-integration-tests branch from 3e4355b to 4ac3466 Compare August 4, 2025 10:31
@maximpn maximpn requested a review from nikitaindik August 4, 2025 10:41
@maximpn maximpn marked this pull request as ready for review August 4, 2025 10:41
@maximpn maximpn requested review from a team as code owners August 4, 2025 10:41
@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)

@maximpn maximpn changed the title [Security Solution] Fix flakiness in Air-gapped integration tests [Security Solution] Wait for Fleet plugin setup completion in Rule Management integration tests Aug 4, 2025
kibanamachine added a commit that referenced this pull request Aug 4, 2025
…ule Management integration tests (#230338) (#230412)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Security Solution] Wait for Fleet plugin setup completion in Rule
Management integration tests
(#230338)](#230338)

<!--- 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-08-04T12:27:19Z","message":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration tests (#230338)\n\n**Resolves:
https://github.com/elastic/kibana/issues/228844**\n**Resolves:
https://github.com/elastic/kibana/issues/229297**\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n\n## Summary\n\nThis
PR fixes integration tests flakiness caused by a race condition with the
Fleet setup logic.\n\n## Details\n\nInvestigation of the related flaky
integration tests has revealed that Fleet's setup logic (usually
executed upon Kibana startup) performs installed packages
re-installation. However, Fleet allows to make API calls like install a
package. Subsequently some package (for example
`security_detection_engine`) might be installed before Fleet's setup
logic completed. In particular a package installation API call leads to
creation of package installation SO which is read by Fleet's setup
logic. So Fleet \"thinks\" the package was installed some time ago and
required re-installation.\n\nThere is a Fleet bug ticket describing this
issue.\n\nThis fix in this PR just wait for Fleet plugin to finish setup
before running integration tests for Rule Management area.\n\n## Flaky
test runner\n\n- ✅ [200
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)","sha":"2250c52fa0b5fb0e5c923cc5643f10de4e9fa357","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v9.2.0","v9.0.5","v9.1.1","v8.18.5","v8.19.1"],"title":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration
tests","number":230338,"url":"https://github.com/elastic/kibana/pull/230338","mergeCommit":{"message":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration tests (#230338)\n\n**Resolves:
https://github.com/elastic/kibana/issues/228844**\n**Resolves:
https://github.com/elastic/kibana/issues/229297**\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n\n## Summary\n\nThis
PR fixes integration tests flakiness caused by a race condition with the
Fleet setup logic.\n\n## Details\n\nInvestigation of the related flaky
integration tests has revealed that Fleet's setup logic (usually
executed upon Kibana startup) performs installed packages
re-installation. However, Fleet allows to make API calls like install a
package. Subsequently some package (for example
`security_detection_engine`) might be installed before Fleet's setup
logic completed. In particular a package installation API call leads to
creation of package installation SO which is read by Fleet's setup
logic. So Fleet \"thinks\" the package was installed some time ago and
required re-installation.\n\nThere is a Fleet bug ticket describing this
issue.\n\nThis fix in this PR just wait for Fleet plugin to finish setup
before running integration tests for Rule Management area.\n\n## Flaky
test runner\n\n- ✅ [200
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)","sha":"2250c52fa0b5fb0e5c923cc5643f10de4e9fa357"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","9.1","8.18","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/230338","number":230338,"mergeCommit":{"message":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration tests (#230338)\n\n**Resolves:
https://github.com/elastic/kibana/issues/228844**\n**Resolves:
https://github.com/elastic/kibana/issues/229297**\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n\n## Summary\n\nThis
PR fixes integration tests flakiness caused by a race condition with the
Fleet setup logic.\n\n## Details\n\nInvestigation of the related flaky
integration tests has revealed that Fleet's setup logic (usually
executed upon Kibana startup) performs installed packages
re-installation. However, Fleet allows to make API calls like install a
package. Subsequently some package (for example
`security_detection_engine`) might be installed before Fleet's setup
logic completed. In particular a package installation API call leads to
creation of package installation SO which is read by Fleet's setup
logic. So Fleet \"thinks\" the package was installed some time ago and
required re-installation.\n\nThere is a Fleet bug ticket describing this
issue.\n\nThis fix in this PR just wait for Fleet plugin to finish setup
before running integration tests for Rule Management area.\n\n## Flaky
test runner\n\n- ✅ [200
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)","sha":"2250c52fa0b5fb0e5c923cc5643f10de4e9fa357"}},{"branch":"9.0","label":"v9.0.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
kibanamachine added a commit that referenced this pull request Aug 4, 2025
…Rule Management integration tests (#230338) (#230411)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Security Solution] Wait for Fleet plugin setup completion in Rule
Management integration tests
(#230338)](#230338)

<!--- 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-08-04T12:27:19Z","message":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration tests (#230338)\n\n**Resolves:
https://github.com/elastic/kibana/issues/228844**\n**Resolves:
https://github.com/elastic/kibana/issues/229297**\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n\n## Summary\n\nThis
PR fixes integration tests flakiness caused by a race condition with the
Fleet setup logic.\n\n## Details\n\nInvestigation of the related flaky
integration tests has revealed that Fleet's setup logic (usually
executed upon Kibana startup) performs installed packages
re-installation. However, Fleet allows to make API calls like install a
package. Subsequently some package (for example
`security_detection_engine`) might be installed before Fleet's setup
logic completed. In particular a package installation API call leads to
creation of package installation SO which is read by Fleet's setup
logic. So Fleet \"thinks\" the package was installed some time ago and
required re-installation.\n\nThere is a Fleet bug ticket describing this
issue.\n\nThis fix in this PR just wait for Fleet plugin to finish setup
before running integration tests for Rule Management area.\n\n## Flaky
test runner\n\n- ✅ [200
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)","sha":"2250c52fa0b5fb0e5c923cc5643f10de4e9fa357","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v9.2.0","v9.0.5","v9.1.1","v8.18.5","v8.19.1"],"title":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration
tests","number":230338,"url":"https://github.com/elastic/kibana/pull/230338","mergeCommit":{"message":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration tests (#230338)\n\n**Resolves:
https://github.com/elastic/kibana/issues/228844**\n**Resolves:
https://github.com/elastic/kibana/issues/229297**\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n\n## Summary\n\nThis
PR fixes integration tests flakiness caused by a race condition with the
Fleet setup logic.\n\n## Details\n\nInvestigation of the related flaky
integration tests has revealed that Fleet's setup logic (usually
executed upon Kibana startup) performs installed packages
re-installation. However, Fleet allows to make API calls like install a
package. Subsequently some package (for example
`security_detection_engine`) might be installed before Fleet's setup
logic completed. In particular a package installation API call leads to
creation of package installation SO which is read by Fleet's setup
logic. So Fleet \"thinks\" the package was installed some time ago and
required re-installation.\n\nThere is a Fleet bug ticket describing this
issue.\n\nThis fix in this PR just wait for Fleet plugin to finish setup
before running integration tests for Rule Management area.\n\n## Flaky
test runner\n\n- ✅ [200
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)","sha":"2250c52fa0b5fb0e5c923cc5643f10de4e9fa357"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","9.1","8.18","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/230338","number":230338,"mergeCommit":{"message":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration tests (#230338)\n\n**Resolves:
https://github.com/elastic/kibana/issues/228844**\n**Resolves:
https://github.com/elastic/kibana/issues/229297**\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n\n## Summary\n\nThis
PR fixes integration tests flakiness caused by a race condition with the
Fleet setup logic.\n\n## Details\n\nInvestigation of the related flaky
integration tests has revealed that Fleet's setup logic (usually
executed upon Kibana startup) performs installed packages
re-installation. However, Fleet allows to make API calls like install a
package. Subsequently some package (for example
`security_detection_engine`) might be installed before Fleet's setup
logic completed. In particular a package installation API call leads to
creation of package installation SO which is read by Fleet's setup
logic. So Fleet \"thinks\" the package was installed some time ago and
required re-installation.\n\nThere is a Fleet bug ticket describing this
issue.\n\nThis fix in this PR just wait for Fleet plugin to finish setup
before running integration tests for Rule Management area.\n\n## Flaky
test runner\n\n- ✅ [200
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)","sha":"2250c52fa0b5fb0e5c923cc5643f10de4e9fa357"}},{"branch":"9.0","label":"v9.0.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
kibanamachine added a commit that referenced this pull request Aug 4, 2025
…Rule Management integration tests (#230338) (#230410)

# Backport

This will backport the following commits from `main` to `8.18`:
- [[Security Solution] Wait for Fleet plugin setup completion in Rule
Management integration tests
(#230338)](#230338)

<!--- 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-08-04T12:27:19Z","message":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration tests (#230338)\n\n**Resolves:
https://github.com/elastic/kibana/issues/228844**\n**Resolves:
https://github.com/elastic/kibana/issues/229297**\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n\n## Summary\n\nThis
PR fixes integration tests flakiness caused by a race condition with the
Fleet setup logic.\n\n## Details\n\nInvestigation of the related flaky
integration tests has revealed that Fleet's setup logic (usually
executed upon Kibana startup) performs installed packages
re-installation. However, Fleet allows to make API calls like install a
package. Subsequently some package (for example
`security_detection_engine`) might be installed before Fleet's setup
logic completed. In particular a package installation API call leads to
creation of package installation SO which is read by Fleet's setup
logic. So Fleet \"thinks\" the package was installed some time ago and
required re-installation.\n\nThere is a Fleet bug ticket describing this
issue.\n\nThis fix in this PR just wait for Fleet plugin to finish setup
before running integration tests for Rule Management area.\n\n## Flaky
test runner\n\n- ✅ [200
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)","sha":"2250c52fa0b5fb0e5c923cc5643f10de4e9fa357","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v9.2.0","v9.0.5","v9.1.1","v8.18.5","v8.19.1"],"title":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration
tests","number":230338,"url":"https://github.com/elastic/kibana/pull/230338","mergeCommit":{"message":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration tests (#230338)\n\n**Resolves:
https://github.com/elastic/kibana/issues/228844**\n**Resolves:
https://github.com/elastic/kibana/issues/229297**\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n\n## Summary\n\nThis
PR fixes integration tests flakiness caused by a race condition with the
Fleet setup logic.\n\n## Details\n\nInvestigation of the related flaky
integration tests has revealed that Fleet's setup logic (usually
executed upon Kibana startup) performs installed packages
re-installation. However, Fleet allows to make API calls like install a
package. Subsequently some package (for example
`security_detection_engine`) might be installed before Fleet's setup
logic completed. In particular a package installation API call leads to
creation of package installation SO which is read by Fleet's setup
logic. So Fleet \"thinks\" the package was installed some time ago and
required re-installation.\n\nThere is a Fleet bug ticket describing this
issue.\n\nThis fix in this PR just wait for Fleet plugin to finish setup
before running integration tests for Rule Management area.\n\n## Flaky
test runner\n\n- ✅ [200
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)","sha":"2250c52fa0b5fb0e5c923cc5643f10de4e9fa357"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","9.1","8.18","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/230338","number":230338,"mergeCommit":{"message":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration tests (#230338)\n\n**Resolves:
https://github.com/elastic/kibana/issues/228844**\n**Resolves:
https://github.com/elastic/kibana/issues/229297**\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n\n## Summary\n\nThis
PR fixes integration tests flakiness caused by a race condition with the
Fleet setup logic.\n\n## Details\n\nInvestigation of the related flaky
integration tests has revealed that Fleet's setup logic (usually
executed upon Kibana startup) performs installed packages
re-installation. However, Fleet allows to make API calls like install a
package. Subsequently some package (for example
`security_detection_engine`) might be installed before Fleet's setup
logic completed. In particular a package installation API call leads to
creation of package installation SO which is read by Fleet's setup
logic. So Fleet \"thinks\" the package was installed some time ago and
required re-installation.\n\nThere is a Fleet bug ticket describing this
issue.\n\nThis fix in this PR just wait for Fleet plugin to finish setup
before running integration tests for Rule Management area.\n\n## Flaky
test runner\n\n- ✅ [200
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)","sha":"2250c52fa0b5fb0e5c923cc5643f10de4e9fa357"}},{"branch":"9.0","label":"v9.0.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
szaffarano pushed a commit to szaffarano/kibana that referenced this pull request Aug 5, 2025
…nagement integration tests (elastic#230338)

**Resolves: elastic#228844
**Resolves: elastic#229297
**Relates to: elastic#230363

## Summary

This PR fixes integration tests flakiness caused by a race condition with the Fleet setup logic.

## Details

Investigation of the related flaky integration tests has revealed that Fleet's setup logic (usually executed upon Kibana startup) performs installed packages re-installation. However, Fleet allows to make API calls like install a package. Subsequently some package (for example `security_detection_engine`) might be installed before Fleet's setup logic completed. In particular a package installation API call leads to creation of package installation SO which is read by Fleet's setup logic. So Fleet "thinks" the package was installed some time ago and required re-installation.

There is a Fleet bug ticket describing this issue.

This fix in this PR just wait for Fleet plugin to finish setup before running integration tests for Rule Management area.

## Flaky test runner

- ✅ [200 runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)
@banderror
Copy link
Contributor

This PR is awesome, thank you @maximpn!

maximpn added a commit to maximpn/kibana that referenced this pull request Aug 5, 2025
…nagement integration tests (elastic#230338)

**Resolves: elastic#228844
**Resolves: elastic#229297
**Relates to: elastic#230363

## Summary

This PR fixes integration tests flakiness caused by a race condition with the Fleet setup logic.

## Details

Investigation of the related flaky integration tests has revealed that Fleet's setup logic (usually executed upon Kibana startup) performs installed packages re-installation. However, Fleet allows to make API calls like install a package. Subsequently some package (for example `security_detection_engine`) might be installed before Fleet's setup logic completed. In particular a package installation API call leads to creation of package installation SO which is read by Fleet's setup logic. So Fleet "thinks" the package was installed some time ago and required re-installation.

There is a Fleet bug ticket describing this issue.

This fix in this PR just wait for Fleet plugin to finish setup before running integration tests for Rule Management area.

## Flaky test runner

- ✅ [200 runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)

(cherry picked from commit 2250c52)
@maximpn
Copy link
Contributor Author

maximpn commented Aug 5, 2025

💚 All backports created successfully

Status Branch Result
9.1

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

Questions ?

Please refer to the Backport tool documentation

maximpn added a commit that referenced this pull request Aug 5, 2025
…ule Management integration tests (#230338) (#230573)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Security Solution] Wait for Fleet plugin setup completion in Rule
Management integration tests
(#230338)](#230338)

<!--- Backport version: 10.0.1 -->

### 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-08-04T12:27:19Z","message":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration tests (#230338)\n\n**Resolves:
https://github.com/elastic/kibana/issues/228844**\n**Resolves:
https://github.com/elastic/kibana/issues/229297**\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n\n## Summary\n\nThis
PR fixes integration tests flakiness caused by a race condition with the
Fleet setup logic.\n\n## Details\n\nInvestigation of the related flaky
integration tests has revealed that Fleet's setup logic (usually
executed upon Kibana startup) performs installed packages
re-installation. However, Fleet allows to make API calls like install a
package. Subsequently some package (for example
`security_detection_engine`) might be installed before Fleet's setup
logic completed. In particular a package installation API call leads to
creation of package installation SO which is read by Fleet's setup
logic. So Fleet \"thinks\" the package was installed some time ago and
required re-installation.\n\nThere is a Fleet bug ticket describing this
issue.\n\nThis fix in this PR just wait for Fleet plugin to finish setup
before running integration tests for Rule Management area.\n\n## Flaky
test runner\n\n- ✅ [200
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)","sha":"2250c52fa0b5fb0e5c923cc5643f10de4e9fa357","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v9.2.0","v9.0.5","v9.1.1","v8.18.5","v8.19.1"],"title":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration
tests","number":230338,"url":"https://github.com/elastic/kibana/pull/230338","mergeCommit":{"message":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration tests (#230338)\n\n**Resolves:
https://github.com/elastic/kibana/issues/228844**\n**Resolves:
https://github.com/elastic/kibana/issues/229297**\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n\n## Summary\n\nThis
PR fixes integration tests flakiness caused by a race condition with the
Fleet setup logic.\n\n## Details\n\nInvestigation of the related flaky
integration tests has revealed that Fleet's setup logic (usually
executed upon Kibana startup) performs installed packages
re-installation. However, Fleet allows to make API calls like install a
package. Subsequently some package (for example
`security_detection_engine`) might be installed before Fleet's setup
logic completed. In particular a package installation API call leads to
creation of package installation SO which is read by Fleet's setup
logic. So Fleet \"thinks\" the package was installed some time ago and
required re-installation.\n\nThere is a Fleet bug ticket describing this
issue.\n\nThis fix in this PR just wait for Fleet plugin to finish setup
before running integration tests for Rule Management area.\n\n## Flaky
test runner\n\n- ✅ [200
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)","sha":"2250c52fa0b5fb0e5c923cc5643f10de4e9fa357"}},"sourceBranch":"main","suggestedTargetBranches":["9.1"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/230338","number":230338,"mergeCommit":{"message":"[Security
Solution] Wait for Fleet plugin setup completion in Rule Management
integration tests (#230338)\n\n**Resolves:
https://github.com/elastic/kibana/issues/228844**\n**Resolves:
https://github.com/elastic/kibana/issues/229297**\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n\n## Summary\n\nThis
PR fixes integration tests flakiness caused by a race condition with the
Fleet setup logic.\n\n## Details\n\nInvestigation of the related flaky
integration tests has revealed that Fleet's setup logic (usually
executed upon Kibana startup) performs installed packages
re-installation. However, Fleet allows to make API calls like install a
package. Subsequently some package (for example
`security_detection_engine`) might be installed before Fleet's setup
logic completed. In particular a package installation API call leads to
creation of package installation SO which is read by Fleet's setup
logic. So Fleet \"thinks\" the package was installed some time ago and
required re-installation.\n\nThere is a Fleet bug ticket describing this
issue.\n\nThis fix in this PR just wait for Fleet plugin to finish setup
before running integration tests for Rule Management area.\n\n## Flaky
test runner\n\n- ✅ [200
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)","sha":"2250c52fa0b5fb0e5c923cc5643f10de4e9fa357"}},{"branch":"9.0","label":"v9.0.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/230412","number":230412,"state":"MERGED","mergeCommit":{"sha":"09459eaf0a2e8e59c363e67387e535396922521f","message":"[9.0]
[Security Solution] Wait for Fleet plugin setup completion in Rule
Management integration tests (#230338) (#230412)\n\n# Backport\n\nThis
will backport the following commits from `main` to `9.0`:\n- [[Security
Solution] Wait for Fleet plugin setup completion in Rule\nManagement
integration
tests\n(#230338)](https://github.com/elastic/kibana/pull/230338)\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":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/230410","number":230410,"state":"MERGED","mergeCommit":{"sha":"8b9a3e7b36e1c7e21434fc46a686c511d29afc4f","message":"[8.18]
[Security Solution] Wait for Fleet plugin setup completion in Rule
Management integration tests (#230338) (#230410)\n\n# Backport\n\nThis
will backport the following commits from `main` to `8.18`:\n- [[Security
Solution] Wait for Fleet plugin setup completion in Rule\nManagement
integration
tests\n(#230338)](https://github.com/elastic/kibana/pull/230338)\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.19","label":"v8.19.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/230411","number":230411,"state":"MERGED","mergeCommit":{"sha":"d02d0445f542f69a3f6a92c0525df1340e30f63a","message":"[8.19]
[Security Solution] Wait for Fleet plugin setup completion in Rule
Management integration tests (#230338) (#230411)\n\n# Backport\n\nThis
will backport the following commits from `main` to `8.19`:\n- [[Security
Solution] Wait for Fleet plugin setup completion in Rule\nManagement
integration
tests\n(#230338)](https://github.com/elastic/kibana/pull/230338)\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>"}}]}] BACKPORT-->
delanni pushed a commit to delanni/kibana that referenced this pull request Aug 5, 2025
…nagement integration tests (elastic#230338)

**Resolves: elastic#228844
**Resolves: elastic#229297
**Relates to: elastic#230363

## Summary

This PR fixes integration tests flakiness caused by a race condition with the Fleet setup logic.

## Details

Investigation of the related flaky integration tests has revealed that Fleet's setup logic (usually executed upon Kibana startup) performs installed packages re-installation. However, Fleet allows to make API calls like install a package. Subsequently some package (for example `security_detection_engine`) might be installed before Fleet's setup logic completed. In particular a package installation API call leads to creation of package installation SO which is read by Fleet's setup logic. So Fleet "thinks" the package was installed some time ago and required re-installation.

There is a Fleet bug ticket describing this issue.

This fix in this PR just wait for Fleet plugin to finish setup before running integration tests for Rule Management area.

## Flaky test runner

- ✅ [200 runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)
maximpn added a commit that referenced this pull request Aug 6, 2025
… running tests (#230632)

**Relates to: #230363
**Relates to: #230338

## Summary

This PR makes sure Cypress e2e test run after Fleet setup is finished. This approach is similar to #230338 used in our integration tests.

Fleet setup running concurrently to the tests may cause tests flakiness. This behavior is described in #230363.
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 6, 2025
… running tests (elastic#230632)

**Relates to: elastic#230363
**Relates to: elastic#230338

## Summary

This PR makes sure Cypress e2e test run after Fleet setup is finished. This approach is similar to elastic#230338 used in our integration tests.

Fleet setup running concurrently to the tests may cause tests flakiness. This behavior is described in elastic#230363.

(cherry picked from commit 649c0dc)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 6, 2025
… running tests (elastic#230632)

**Relates to: elastic#230363
**Relates to: elastic#230338

## Summary

This PR makes sure Cypress e2e test run after Fleet setup is finished. This approach is similar to elastic#230338 used in our integration tests.

Fleet setup running concurrently to the tests may cause tests flakiness. This behavior is described in elastic#230363.

(cherry picked from commit 649c0dc)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 6, 2025
… running tests (elastic#230632)

**Relates to: elastic#230363
**Relates to: elastic#230338

## Summary

This PR makes sure Cypress e2e test run after Fleet setup is finished. This approach is similar to elastic#230338 used in our integration tests.

Fleet setup running concurrently to the tests may cause tests flakiness. This behavior is described in elastic#230363.

(cherry picked from commit 649c0dc)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 6, 2025
… running tests (elastic#230632)

**Relates to: elastic#230363
**Relates to: elastic#230338

## Summary

This PR makes sure Cypress e2e test run after Fleet setup is finished. This approach is similar to elastic#230338 used in our integration tests.

Fleet setup running concurrently to the tests may cause tests flakiness. This behavior is described in elastic#230363.

(cherry picked from commit 649c0dc)
kibanamachine added a commit that referenced this pull request Aug 6, 2025
…before running tests (#230632) (#230886)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Security Solution] Wait for Fleet setup completion in Cypress before
running tests (#230632)](#230632)

<!--- 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-08-06T21:52:25Z","message":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests (#230632)\n\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n**Relates to:
https://github.com/elastic/kibana/pull/230338**\n\n## Summary\n\nThis PR
makes sure Cypress e2e test run after Fleet setup is finished. This
approach is similar to #230338
used in our integration tests.\n\nFleet setup running concurrently to
the tests may cause tests flakiness. This behavior is described in
https://github.com/elastic/kibana/issues/230363.","sha":"649c0dcea513a85f5ff04627c6f837f12b57199e","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","impact:high","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v9.2.0","v9.0.5","v9.1.1","v8.18.5","v8.19.1"],"title":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests","number":230632,"url":"https://github.com/elastic/kibana/pull/230632","mergeCommit":{"message":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests (#230632)\n\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n**Relates to:
https://github.com/elastic/kibana/pull/230338**\n\n## Summary\n\nThis PR
makes sure Cypress e2e test run after Fleet setup is finished. This
approach is similar to #230338
used in our integration tests.\n\nFleet setup running concurrently to
the tests may cause tests flakiness. This behavior is described in
https://github.com/elastic/kibana/issues/230363.","sha":"649c0dcea513a85f5ff04627c6f837f12b57199e"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","9.1","8.18","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/230632","number":230632,"mergeCommit":{"message":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests (#230632)\n\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n**Relates to:
https://github.com/elastic/kibana/pull/230338**\n\n## Summary\n\nThis PR
makes sure Cypress e2e test run after Fleet setup is finished. This
approach is similar to #230338
used in our integration tests.\n\nFleet setup running concurrently to
the tests may cause tests flakiness. This behavior is described in
https://github.com/elastic/kibana/issues/230363.","sha":"649c0dcea513a85f5ff04627c6f837f12b57199e"}},{"branch":"9.0","label":"v9.0.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
kibanamachine added a commit that referenced this pull request Aug 6, 2025
… before running tests (#230632) (#230884)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Security Solution] Wait for Fleet setup completion in Cypress before
running tests (#230632)](#230632)

<!--- 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-08-06T21:52:25Z","message":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests (#230632)\n\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n**Relates to:
https://github.com/elastic/kibana/pull/230338**\n\n## Summary\n\nThis PR
makes sure Cypress e2e test run after Fleet setup is finished. This
approach is similar to #230338
used in our integration tests.\n\nFleet setup running concurrently to
the tests may cause tests flakiness. This behavior is described in
https://github.com/elastic/kibana/issues/230363.","sha":"649c0dcea513a85f5ff04627c6f837f12b57199e","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","impact:high","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v9.2.0","v9.0.5","v9.1.1","v8.18.5","v8.19.1"],"title":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests","number":230632,"url":"https://github.com/elastic/kibana/pull/230632","mergeCommit":{"message":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests (#230632)\n\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n**Relates to:
https://github.com/elastic/kibana/pull/230338**\n\n## Summary\n\nThis PR
makes sure Cypress e2e test run after Fleet setup is finished. This
approach is similar to #230338
used in our integration tests.\n\nFleet setup running concurrently to
the tests may cause tests flakiness. This behavior is described in
https://github.com/elastic/kibana/issues/230363.","sha":"649c0dcea513a85f5ff04627c6f837f12b57199e"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","9.1","8.18","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/230632","number":230632,"mergeCommit":{"message":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests (#230632)\n\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n**Relates to:
https://github.com/elastic/kibana/pull/230338**\n\n## Summary\n\nThis PR
makes sure Cypress e2e test run after Fleet setup is finished. This
approach is similar to #230338
used in our integration tests.\n\nFleet setup running concurrently to
the tests may cause tests flakiness. This behavior is described in
https://github.com/elastic/kibana/issues/230363.","sha":"649c0dcea513a85f5ff04627c6f837f12b57199e"}},{"branch":"9.0","label":"v9.0.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
kibanamachine added a commit that referenced this pull request Aug 6, 2025
…before running tests (#230632) (#230885)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Security Solution] Wait for Fleet setup completion in Cypress before
running tests (#230632)](#230632)

<!--- 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-08-06T21:52:25Z","message":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests (#230632)\n\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n**Relates to:
https://github.com/elastic/kibana/pull/230338**\n\n## Summary\n\nThis PR
makes sure Cypress e2e test run after Fleet setup is finished. This
approach is similar to #230338
used in our integration tests.\n\nFleet setup running concurrently to
the tests may cause tests flakiness. This behavior is described in
https://github.com/elastic/kibana/issues/230363.","sha":"649c0dcea513a85f5ff04627c6f837f12b57199e","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","impact:high","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v9.2.0","v9.0.5","v9.1.1","v8.18.5","v8.19.1"],"title":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests","number":230632,"url":"https://github.com/elastic/kibana/pull/230632","mergeCommit":{"message":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests (#230632)\n\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n**Relates to:
https://github.com/elastic/kibana/pull/230338**\n\n## Summary\n\nThis PR
makes sure Cypress e2e test run after Fleet setup is finished. This
approach is similar to #230338
used in our integration tests.\n\nFleet setup running concurrently to
the tests may cause tests flakiness. This behavior is described in
https://github.com/elastic/kibana/issues/230363.","sha":"649c0dcea513a85f5ff04627c6f837f12b57199e"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","9.1","8.18","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/230632","number":230632,"mergeCommit":{"message":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests (#230632)\n\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n**Relates to:
https://github.com/elastic/kibana/pull/230338**\n\n## Summary\n\nThis PR
makes sure Cypress e2e test run after Fleet setup is finished. This
approach is similar to #230338
used in our integration tests.\n\nFleet setup running concurrently to
the tests may cause tests flakiness. This behavior is described in
https://github.com/elastic/kibana/issues/230363.","sha":"649c0dcea513a85f5ff04627c6f837f12b57199e"}},{"branch":"9.0","label":"v9.0.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
kibanamachine added a commit that referenced this pull request Aug 7, 2025
… before running tests (#230632) (#230883)

# Backport

This will backport the following commits from `main` to `8.18`:
- [[Security Solution] Wait for Fleet setup completion in Cypress before
running tests (#230632)](#230632)

<!--- 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-08-06T21:52:25Z","message":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests (#230632)\n\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n**Relates to:
https://github.com/elastic/kibana/pull/230338**\n\n## Summary\n\nThis PR
makes sure Cypress e2e test run after Fleet setup is finished. This
approach is similar to #230338
used in our integration tests.\n\nFleet setup running concurrently to
the tests may cause tests flakiness. This behavior is described in
https://github.com/elastic/kibana/issues/230363.","sha":"649c0dcea513a85f5ff04627c6f837f12b57199e","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","impact:high","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:version","v9.2.0","v9.0.5","v9.1.1","v8.18.5","v8.19.1"],"title":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests","number":230632,"url":"https://github.com/elastic/kibana/pull/230632","mergeCommit":{"message":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests (#230632)\n\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n**Relates to:
https://github.com/elastic/kibana/pull/230338**\n\n## Summary\n\nThis PR
makes sure Cypress e2e test run after Fleet setup is finished. This
approach is similar to #230338
used in our integration tests.\n\nFleet setup running concurrently to
the tests may cause tests flakiness. This behavior is described in
https://github.com/elastic/kibana/issues/230363.","sha":"649c0dcea513a85f5ff04627c6f837f12b57199e"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","9.1","8.18","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/230632","number":230632,"mergeCommit":{"message":"[Security
Solution] Wait for Fleet setup completion in Cypress before running
tests (#230632)\n\n**Relates to:
https://github.com/elastic/kibana/issues/230363**\n**Relates to:
https://github.com/elastic/kibana/pull/230338**\n\n## Summary\n\nThis PR
makes sure Cypress e2e test run after Fleet setup is finished. This
approach is similar to #230338
used in our integration tests.\n\nFleet setup running concurrently to
the tests may cause tests flakiness. This behavior is described in
https://github.com/elastic/kibana/issues/230363.","sha":"649c0dcea513a85f5ff04627c6f837f12b57199e"}},{"branch":"9.0","label":"v9.0.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
gergoabraham pushed a commit to gergoabraham/kibana that referenced this pull request Aug 7, 2025
… running tests (elastic#230632)

**Relates to: elastic#230363
**Relates to: elastic#230338

## Summary

This PR makes sure Cypress e2e test run after Fleet setup is finished. This approach is similar to elastic#230338 used in our integration tests.

Fleet setup running concurrently to the tests may cause tests flakiness. This behavior is described in elastic#230363.
@wildemat wildemat mentioned this pull request Aug 7, 2025
10 tasks
@mistic mistic added v9.1.2 and removed v9.1.1 labels Aug 7, 2025
denar50 pushed a commit to denar50/kibana that referenced this pull request Aug 8, 2025
… running tests (elastic#230632)

**Relates to: elastic#230363
**Relates to: elastic#230338

## Summary

This PR makes sure Cypress e2e test run after Fleet setup is finished. This approach is similar to elastic#230338 used in our integration tests.

Fleet setup running concurrently to the tests may cause tests flakiness. This behavior is described in elastic#230363.
NicholasPeretti pushed a commit to NicholasPeretti/kibana that referenced this pull request Aug 18, 2025
…nagement integration tests (elastic#230338)

**Resolves: elastic#228844
**Resolves: elastic#229297
**Relates to: elastic#230363

## Summary

This PR fixes integration tests flakiness caused by a race condition with the Fleet setup logic.

## Details

Investigation of the related flaky integration tests has revealed that Fleet's setup logic (usually executed upon Kibana startup) performs installed packages re-installation. However, Fleet allows to make API calls like install a package. Subsequently some package (for example `security_detection_engine`) might be installed before Fleet's setup logic completed. In particular a package installation API call leads to creation of package installation SO which is read by Fleet's setup logic. So Fleet "thinks" the package was installed some time ago and required re-installation.

There is a Fleet bug ticket describing this issue.

This fix in this PR just wait for Fleet plugin to finish setup before running integration tests for Rule Management area.

## Flaky test runner

- ✅ [200 runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8999)
NicholasPeretti pushed a commit to NicholasPeretti/kibana that referenced this pull request Aug 18, 2025
… running tests (elastic#230632)

**Relates to: elastic#230363
**Relates to: elastic#230338

## Summary

This PR makes sure Cypress e2e test run after Fleet setup is finished. This approach is similar to elastic#230338 used in our integration tests.

Fleet setup running concurrently to the tests may cause tests flakiness. This behavior is described in elastic#230363.
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.5 v8.19.1 v9.0.5 v9.1.2 v9.2.0

Projects

None yet

6 participants