[FTR] Add integration tests to verify FTR exit code preservation#243630
[FTR] Add integration tests to verify FTR exit code preservation#243630csr merged 2 commits intoelastic:mainfrom
Conversation
| export default function () { | ||
| describe('exit code test suite', () => { | ||
| it('intentionally fails to verify exit code is preserved', () => { | ||
| throw new Error('intentional failure for exit code test'); |
There was a problem hiding this comment.
maybe instead of throwing an error, a failing assertion is needed in order to simulate the behavior caused the status code issue.
There was a problem hiding this comment.
@fake-haris - while your suggestion will also work, Mocha treats both failed assertions and thrown exceptions in the same way and will consider the test as failing. Either will cause the test to fail and set the exit code to 1, which is what we're testing.
| // The cleanup handler must not override this exit code. | ||
| it('exits with code 0 when tests pass', () => { | ||
| const proc = spawnSync(process.execPath, [SCRIPT, '--config', PASSING_CONFIG], { | ||
| env: { ...process.env, SCOUT_REPORTER_ENABLED: '0' }, |
There was a problem hiding this comment.
have you considered setting TEST_ES_DISABLE_STARTUP, and adding/setting TEST_KIBANA_DISABLE_STARTUP, to speed up the test? or does this config already ensure no services are started?
There was a problem hiding this comment.
@dgieselaar - the current configs (config_passing.js and config_failing.js) do not start any services. They're vary barebones, they just set a dummy Elasticsearch port under servers (which is required).
💔 Build Failed
Failed CI StepsTest Failures
Metrics [docs]
Historycc @csr |
|
Starting backport for target branches: 8.19, 9.1, 9.2 |
…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)
…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)
…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)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…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.
#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>
#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>
…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>
…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.
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
cleanupBeforeExitwas accidentally resetting the exit code to 0 when tests failed.