@kbn/cleanup-before-exit: don't pass in undefined exit code#243499
Merged
kobelb merged 9 commits intoelastic:mainfrom Nov 19, 2025
Merged
@kbn/cleanup-before-exit: don't pass in undefined exit code#243499kobelb merged 9 commits intoelastic:mainfrom
kobelb merged 9 commits intoelastic:mainfrom
Conversation
rmyz
approved these changes
Nov 19, 2025
Contributor
|
Pinging @elastic/fleet (Team:Fleet) |
83916c0 to
43670ea
Compare
jbudz
added a commit
that referenced
this pull request
Nov 20, 2025
jbudz
added a commit
that referenced
this pull request
Nov 20, 2025
Checking for build failures seen in https://buildkite.com/elastic/kibana-on-merge/builds/82173. May be unrelated, failing tests were not propagating previously - see #243499
csr
added a commit
that referenced
this pull request
Nov 20, 2025
…3630) This PR adds two integration tests to verify that FTR preserves exit codes correctly when cleanup handlers are registered via `@kbn/cleanup-before-exit`. This test would have caught the bug fixed in #243499, where `cleanupBeforeExit` was accidentally resetting the exit code to 0 when tests failed.
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Nov 20, 2025
…stic#243630) This PR adds two integration tests to verify that FTR preserves exit codes correctly when cleanup handlers are registered via `@kbn/cleanup-before-exit`. This test would have caught the bug fixed in elastic#243499, where `cleanupBeforeExit` was accidentally resetting the exit code to 0 when tests failed. (cherry picked from commit 71a871a)
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Nov 20, 2025
…stic#243630) This PR adds two integration tests to verify that FTR preserves exit codes correctly when cleanup handlers are registered via `@kbn/cleanup-before-exit`. This test would have caught the bug fixed in elastic#243499, where `cleanupBeforeExit` was accidentally resetting the exit code to 0 when tests failed. (cherry picked from commit 71a871a)
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Nov 20, 2025
…stic#243630) This PR adds two integration tests to verify that FTR preserves exit codes correctly when cleanup handlers are registered via `@kbn/cleanup-before-exit`. This test would have caught the bug fixed in elastic#243499, where `cleanupBeforeExit` was accidentally resetting the exit code to 0 when tests failed. (cherry picked from commit 71a871a)
andrimal
pushed a commit
to andrimal/kibana
that referenced
this pull request
Nov 20, 2025
…243499) `@kbn/cleanup-before-exit` previously called `process.exit(exitCode)` even when the exitCode is undefined. Passing in `undefined` actually overrides a previously set `process.exitCode`. This unintentionally causes the exitCode to be 0 when process.exitCode has been set to a non-zero value. After elastic#228692 was merged, `@kbn/cleanup-before-exit` became active for FTR runs because `initMetrics` uses this function, and FTR uses `process.exitCode`, which caused false positives in CI. We're skipping test suites to allow the fix to roll in, and prevent further unnoticed errors going to main. Skipped suites / cases in: - [ ] .buildkite/ftr_platform_stateful_configs.yml / x-pack/performance/journeys_e2e/aiops_log_rate_analysis.ts - [ ] src/platform/test/api_integration/apis/dashboards/get_dashboard/main.ts - [x] src/platform/test/functional/apps/discover/group10/_lens_vis.ts - [ ] x-pack/platform/test/fleet_api_integration/apis/package_policy/delete.ts - [ ] x-pack/platform/test/functional_execution_context/tests/log_correlation.ts - [ ] x-pack/solutions/search/test/functional_search/tests/classic_navigation.basic.ts - [ ] x-pack/solutions/search/test/functional_search/tests/classic_navigation.ts - [ ] x-pack/solutions/security/test/api_integration/apis/cloud_security_posture/benchmark/v2.ts - [ ] x-pack/solutions/security/test/serverless/api_integration/test_suites/platform_security/authorization.ts - [ ] x-pack/platform/test/functional/apps/aiops/change_point_detection.ts - [ ] src/platform/test/api_integration/apis/metrics_experience/fields.ts - [ ] x-pack/solutions/security/test/security_solution_api_integration/test_suites/genai/attack_discovery/schedules/trial_license_complete_tier/find/find.ts - [ ] x-pack/platform/test/reporting_functional/reporting_and_security/management.ts --------- Co-authored-by: Alex Szabo <alex.szabo@elastic.co> Co-authored-by: Jonathan Budzenski <jon@elastic.co> Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co>
andrimal
pushed a commit
to andrimal/kibana
that referenced
this pull request
Nov 20, 2025
…lastic#243586) Checking for build failures seen in https://buildkite.com/elastic/kibana-on-merge/builds/82173. May be unrelated, failing tests were not propagating previously - see elastic#243499
andrimal
pushed a commit
to andrimal/kibana
that referenced
this pull request
Nov 20, 2025
…stic#243630) This PR adds two integration tests to verify that FTR preserves exit codes correctly when cleanup handlers are registered via `@kbn/cleanup-before-exit`. This test would have caught the bug fixed in elastic#243499, where `cleanupBeforeExit` was accidentally resetting the exit code to 0 when tests failed.
andrimal
pushed a commit
to andrimal/kibana
that referenced
this pull request
Nov 20, 2025
…st (elastic#243568) Fixes and unskips test skipped in elastic#243499 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
kibanamachine
added a commit
that referenced
this pull request
Nov 20, 2025
#243630) (#243673) # Backport This will backport the following commits from `main` to `9.1`: - [[FTR] Add integration tests to verify FTR exit code preservation (#243630)](#243630) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Cesare de Cal","email":"cesare.decal@elastic.co"},"sourceCommit":{"committedDate":"2025-11-20T14:46:51Z","message":"[FTR] Add integration tests to verify FTR exit code preservation (#243630)\n\nThis PR adds two integration tests to verify that FTR preserves exit\ncodes correctly when cleanup handlers are registered via\n`@kbn/cleanup-before-exit`.\n\nThis test would have caught the bug fixed in #243499, where\n`cleanupBeforeExit` was accidentally resetting the exit code to 0 when\ntests failed.","sha":"71a871a3c402387be2b4040f2728f850eea17f7e","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.3.0"],"title":"[FTR] Add integration tests to verify FTR exit code preservation","number":243630,"url":"https://github.com/elastic/kibana/pull/243630","mergeCommit":{"message":"[FTR] Add integration tests to verify FTR exit code preservation (#243630)\n\nThis PR adds two integration tests to verify that FTR preserves exit\ncodes correctly when cleanup handlers are registered via\n`@kbn/cleanup-before-exit`.\n\nThis test would have caught the bug fixed in #243499, where\n`cleanupBeforeExit` was accidentally resetting the exit code to 0 when\ntests failed.","sha":"71a871a3c402387be2b4040f2728f850eea17f7e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/243630","number":243630,"mergeCommit":{"message":"[FTR] Add integration tests to verify FTR exit code preservation (#243630)\n\nThis PR adds two integration tests to verify that FTR preserves exit\ncodes correctly when cleanup handlers are registered via\n`@kbn/cleanup-before-exit`.\n\nThis test would have caught the bug fixed in #243499, where\n`cleanupBeforeExit` was accidentally resetting the exit code to 0 when\ntests failed.","sha":"71a871a3c402387be2b4040f2728f850eea17f7e"}}]}] BACKPORT--> Co-authored-by: Cesare de Cal <cesare.decal@elastic.co>
kibanamachine
added a commit
that referenced
this pull request
Nov 20, 2025
#243630) (#243674) # Backport This will backport the following commits from `main` to `9.2`: - [[FTR] Add integration tests to verify FTR exit code preservation (#243630)](#243630) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Cesare de Cal","email":"cesare.decal@elastic.co"},"sourceCommit":{"committedDate":"2025-11-20T14:46:51Z","message":"[FTR] Add integration tests to verify FTR exit code preservation (#243630)\n\nThis PR adds two integration tests to verify that FTR preserves exit\ncodes correctly when cleanup handlers are registered via\n`@kbn/cleanup-before-exit`.\n\nThis test would have caught the bug fixed in #243499, where\n`cleanupBeforeExit` was accidentally resetting the exit code to 0 when\ntests failed.","sha":"71a871a3c402387be2b4040f2728f850eea17f7e","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.3.0"],"title":"[FTR] Add integration tests to verify FTR exit code preservation","number":243630,"url":"https://github.com/elastic/kibana/pull/243630","mergeCommit":{"message":"[FTR] Add integration tests to verify FTR exit code preservation (#243630)\n\nThis PR adds two integration tests to verify that FTR preserves exit\ncodes correctly when cleanup handlers are registered via\n`@kbn/cleanup-before-exit`.\n\nThis test would have caught the bug fixed in #243499, where\n`cleanupBeforeExit` was accidentally resetting the exit code to 0 when\ntests failed.","sha":"71a871a3c402387be2b4040f2728f850eea17f7e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/243630","number":243630,"mergeCommit":{"message":"[FTR] Add integration tests to verify FTR exit code preservation (#243630)\n\nThis PR adds two integration tests to verify that FTR preserves exit\ncodes correctly when cleanup handlers are registered via\n`@kbn/cleanup-before-exit`.\n\nThis test would have caught the bug fixed in #243499, where\n`cleanupBeforeExit` was accidentally resetting the exit code to 0 when\ntests failed.","sha":"71a871a3c402387be2b4040f2728f850eea17f7e"}}]}] BACKPORT--> Co-authored-by: Cesare de Cal <cesare.decal@elastic.co>
kibanamachine
added a commit
that referenced
this pull request
Nov 20, 2025
…on (#243630) (#243672) # Backport This will backport the following commits from `main` to `8.19`: - [[FTR] Add integration tests to verify FTR exit code preservation (#243630)](#243630) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Cesare de Cal","email":"cesare.decal@elastic.co"},"sourceCommit":{"committedDate":"2025-11-20T14:46:51Z","message":"[FTR] Add integration tests to verify FTR exit code preservation (#243630)\n\nThis PR adds two integration tests to verify that FTR preserves exit\ncodes correctly when cleanup handlers are registered via\n`@kbn/cleanup-before-exit`.\n\nThis test would have caught the bug fixed in #243499, where\n`cleanupBeforeExit` was accidentally resetting the exit code to 0 when\ntests failed.","sha":"71a871a3c402387be2b4040f2728f850eea17f7e","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.3.0"],"title":"[FTR] Add integration tests to verify FTR exit code preservation","number":243630,"url":"https://github.com/elastic/kibana/pull/243630","mergeCommit":{"message":"[FTR] Add integration tests to verify FTR exit code preservation (#243630)\n\nThis PR adds two integration tests to verify that FTR preserves exit\ncodes correctly when cleanup handlers are registered via\n`@kbn/cleanup-before-exit`.\n\nThis test would have caught the bug fixed in #243499, where\n`cleanupBeforeExit` was accidentally resetting the exit code to 0 when\ntests failed.","sha":"71a871a3c402387be2b4040f2728f850eea17f7e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/243630","number":243630,"mergeCommit":{"message":"[FTR] Add integration tests to verify FTR exit code preservation (#243630)\n\nThis PR adds two integration tests to verify that FTR preserves exit\ncodes correctly when cleanup handlers are registered via\n`@kbn/cleanup-before-exit`.\n\nThis test would have caught the bug fixed in #243499, where\n`cleanupBeforeExit` was accidentally resetting the exit code to 0 when\ntests failed.","sha":"71a871a3c402387be2b4040f2728f850eea17f7e"}}]}] BACKPORT--> Co-authored-by: Cesare de Cal <cesare.decal@elastic.co>
This was referenced Dec 1, 2025
Closed
Skipped test: x-pack/platform/test/reporting_functional/reporting_and_security/management.ts
#244714
Closed
Closed
eokoneyo
pushed a commit
to eokoneyo/kibana
that referenced
this pull request
Dec 2, 2025
…243499) `@kbn/cleanup-before-exit` previously called `process.exit(exitCode)` even when the exitCode is undefined. Passing in `undefined` actually overrides a previously set `process.exitCode`. This unintentionally causes the exitCode to be 0 when process.exitCode has been set to a non-zero value. After elastic#228692 was merged, `@kbn/cleanup-before-exit` became active for FTR runs because `initMetrics` uses this function, and FTR uses `process.exitCode`, which caused false positives in CI. We're skipping test suites to allow the fix to roll in, and prevent further unnoticed errors going to main. Skipped suites / cases in: - [ ] .buildkite/ftr_platform_stateful_configs.yml / x-pack/performance/journeys_e2e/aiops_log_rate_analysis.ts - [ ] src/platform/test/api_integration/apis/dashboards/get_dashboard/main.ts - [x] src/platform/test/functional/apps/discover/group10/_lens_vis.ts - [ ] x-pack/platform/test/fleet_api_integration/apis/package_policy/delete.ts - [ ] x-pack/platform/test/functional_execution_context/tests/log_correlation.ts - [ ] x-pack/solutions/search/test/functional_search/tests/classic_navigation.basic.ts - [ ] x-pack/solutions/search/test/functional_search/tests/classic_navigation.ts - [ ] x-pack/solutions/security/test/api_integration/apis/cloud_security_posture/benchmark/v2.ts - [ ] x-pack/solutions/security/test/serverless/api_integration/test_suites/platform_security/authorization.ts - [ ] x-pack/platform/test/functional/apps/aiops/change_point_detection.ts - [ ] src/platform/test/api_integration/apis/metrics_experience/fields.ts - [ ] x-pack/solutions/security/test/security_solution_api_integration/test_suites/genai/attack_discovery/schedules/trial_license_complete_tier/find/find.ts - [ ] x-pack/platform/test/reporting_functional/reporting_and_security/management.ts --------- Co-authored-by: Alex Szabo <alex.szabo@elastic.co> Co-authored-by: Jonathan Budzenski <jon@elastic.co> Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co>
eokoneyo
pushed a commit
to eokoneyo/kibana
that referenced
this pull request
Dec 2, 2025
…lastic#243586) Checking for build failures seen in https://buildkite.com/elastic/kibana-on-merge/builds/82173. May be unrelated, failing tests were not propagating previously - see elastic#243499
eokoneyo
pushed a commit
to eokoneyo/kibana
that referenced
this pull request
Dec 2, 2025
…stic#243630) This PR adds two integration tests to verify that FTR preserves exit codes correctly when cleanup handlers are registered via `@kbn/cleanup-before-exit`. This test would have caught the bug fixed in elastic#243499, where `cleanupBeforeExit` was accidentally resetting the exit code to 0 when tests failed.
eokoneyo
pushed a commit
to eokoneyo/kibana
that referenced
this pull request
Dec 2, 2025
…st (elastic#243568) Fixes and unskips test skipped in elastic#243499 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@kbn/cleanup-before-exitpreviously calledprocess.exit(exitCode)even when the exitCode is undefined. Passing inundefinedactually overrides a previously setprocess.exitCode. This unintentionally causes the exitCode to be 0 when process.exitCode has been set to a non-zero value. After #228692 was merged,@kbn/cleanup-before-exitbecame active for FTR runs becauseinitMetricsuses this function, and FTR usesprocess.exitCode, which caused false positives in CI.We're skipping test suites to allow the fix to roll in, and prevent further unnoticed errors going to main.
Skipped suites / cases in: