Skip to content

[9.4] [Security Solution] Fix flaky Cypress tests that use preventPrebuiltRulesPackageInstallation helper (#271457)#271920

Merged
kibanamachine merged 1 commit into
elastic:9.4from
kibanamachine:backport/9.4/pr-271457
May 29, 2026
Merged

[9.4] [Security Solution] Fix flaky Cypress tests that use preventPrebuiltRulesPackageInstallation helper (#271457)#271920
kibanamachine merged 1 commit into
elastic:9.4from
kibanamachine:backport/9.4/pr-271457

Conversation

@kibanamachine
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.4:

Questions ?

Please refer to the Backport tool documentation

…RulesPackageInstallation` helper (elastic#271457)

Closes elastic#268359, closes elastic#268360, closes elastic#268548, closes elastic#268549, closes
elastic#268566, closes elastic#268567, closes elastic#268708, closes elastic#269232, closes elastic#269233,
closes elastic#269723, closes elastic#270225, closes elastic#270226, closes elastic#270318, closes
elastic#270319, closes elastic#270611, closes elastic#271178, closes elastic#271179, closes elastic#271182,
closes elastic#271183, closes elastic#271193, closes elastic#271543, closes elastic#271544.

This PR fixes flakiness in Cypress tests that use
`preventPrebuiltRulesPackageInstallation` helper.

🟢 Flaky Test Runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/12493

Test used to fail with `Error: Socket closed before finished writing
response`.

We are using `cy.intercept(...)` to intercept initialization flow
requests to skip package installation. However, if initialization
request also contains another flow that's unrelated to package
installation we don't mock the request. If the non-mocked request is in
flight, and during this time Cypress reloads a page (`cy.reload()`), the
request gets canceled and Cypress treats it as an error, although it's a
normal situation.

The fix is using a listener instead of `request.continue(...)`. Listener
doesn't error if test runner navigates away – it just doesn't run if
response wasn't received.

The flakiness was introduced in this PR:
elastic#266690
However, the flaky test runner didn't catch it back then because I
didn't run all the specs that were affected by the change in helper
🤦‍♂️. I updated my skill to make sure it triggers the Flaky Test Runner
for tests that use a shared helper.

(cherry picked from commit 3bb21b1)
@kibanamachine
Copy link
Copy Markdown
Contributor Author

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #50 / Entity Analytics - Watchlists @ess @serverless @skipInServerlessMKI Entity Store Attribute Sync should remove the watchlist id from entity.attributes.watchlists on deletion but preserve other ids

Metrics [docs]

✅ unchanged

cc @nikitaindik

@kibanamachine kibanamachine merged commit 5fcad8d into elastic:9.4 May 29, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants