[Snapshot Restore] Migrate flaky repository_add integration test to unit tests#258974
Conversation
|
Pinging @elastic/kibana-management (Team:Kibana Management) |
bc758ad to
e762e88
Compare
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
📝 WalkthroughWalkthroughThe change replaces a large integration test file for repository add with focused unit tests. The deleted 714-line integration test is removed and four new test files are added: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment Tip CodeRabbit can generate a title for your PR based on the changes.Add |
✅ Actions performedFull review triggered. |
1 similar comment
✅ Actions performedFull review triggered. |
9934d8e to
7ce895a
Compare
1162b9f to
2c77d81
Compare
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
|
…nit tests - Removes flaky `repository_add.test.ts` client integration test - Adds pure unit tests for `validateRepository` (24 tests) - Adds unit tests for `RepositoryFormStepOne` (10 tests) - Adds unit tests for `RepositoryForm` orchestration and payloads (14 tests) - Adds unit test for `RepositoryAdd` page title (1 test) - Unskips previously flaky settings validation (issue elastic#248548) Closes elastic#248548 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2c77d81 to
bf1e1eb
Compare
|
Starting backport for target branches: 9.3 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
…nit tests (elastic#258974) Closes elastic#248548 ## Summary - Migrates flaky `repository_add` client integration test to focused unit tests spread across the source files that own the functionality. - Removes the legacy `__jest__/client_integration/repository_add.test.ts` integration test. - Unskips the previously flaky settings validation test (now a pure function test — no timeouts possible). ## Rationale - The old integration test rendered the full app through a router with async HTTP mock layers, causing flaky 5000ms timeouts on CI (issue elastic#248548). - The new unit tests render components directly with minimal mocks, use synchronous `fireEvent`, and test validation as pure function calls. ## Coverage mapping - [Integration → unit test mapping (gist)](https://gist.github.com/kapral18/b6ccde9cbf84bc18c35fc356861aba50) ## Test Plan - `node scripts/check_changes.ts` — passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/services/validation/validate_repository.test.ts` — 24 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/step_one.test.tsx` — 10 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/repository_form.test.tsx` — 14 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/sections/repository_add/repository_add.test.tsx` — 1 passed Assisted with Claude Code using Claude 4.6 Opus Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nit tests (elastic#258974) Closes elastic#248548 - Migrates flaky `repository_add` client integration test to focused unit tests spread across the source files that own the functionality. - Removes the legacy `__jest__/client_integration/repository_add.test.ts` integration test. - Unskips the previously flaky settings validation test (now a pure function test — no timeouts possible). - The old integration test rendered the full app through a router with async HTTP mock layers, causing flaky 5000ms timeouts on CI (issue - The new unit tests render components directly with minimal mocks, use synchronous `fireEvent`, and test validation as pure function calls. - [Integration → unit test mapping (gist)](https://gist.github.com/kapral18/b6ccde9cbf84bc18c35fc356861aba50) - `node scripts/check_changes.ts` — passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/services/validation/validate_repository.test.ts` — 24 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/step_one.test.tsx` — 10 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/repository_form.test.tsx` — 14 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/sections/repository_add/repository_add.test.tsx` — 1 passed Assisted with Claude Code using Claude 4.6 Opus Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> (cherry picked from commit 6b62324)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…nit tests (elastic#258974) Closes elastic#248548 - Migrates flaky `repository_add` client integration test to focused unit tests spread across the source files that own the functionality. - Removes the legacy `__jest__/client_integration/repository_add.test.ts` integration test. - Unskips the previously flaky settings validation test (now a pure function test — no timeouts possible). - The old integration test rendered the full app through a router with async HTTP mock layers, causing flaky 5000ms timeouts on CI (issue - The new unit tests render components directly with minimal mocks, use synchronous `fireEvent`, and test validation as pure function calls. - [Integration → unit test mapping (gist)](https://gist.github.com/kapral18/b6ccde9cbf84bc18c35fc356861aba50) - `node scripts/check_changes.ts` — passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/services/validation/validate_repository.test.ts` — 24 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/step_one.test.tsx` — 10 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/repository_form.test.tsx` — 14 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/sections/repository_add/repository_add.test.tsx` — 1 passed Assisted with Claude Code using Claude 4.6 Opus Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> (cherry picked from commit 6b62324)
…nit tests (elastic#258974) Closes elastic#248548 ## Summary - Migrates flaky `repository_add` client integration test to focused unit tests spread across the source files that own the functionality. - Removes the legacy `__jest__/client_integration/repository_add.test.ts` integration test. - Unskips the previously flaky settings validation test (now a pure function test — no timeouts possible). ## Rationale - The old integration test rendered the full app through a router with async HTTP mock layers, causing flaky 5000ms timeouts on CI (issue elastic#248548). - The new unit tests render components directly with minimal mocks, use synchronous `fireEvent`, and test validation as pure function calls. ## Coverage mapping - [Integration → unit test mapping (gist)](https://gist.github.com/kapral18/b6ccde9cbf84bc18c35fc356861aba50) ## Test Plan - `node scripts/check_changes.ts` — passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/services/validation/validate_repository.test.ts` — 24 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/step_one.test.tsx` — 10 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/repository_form.test.tsx` — 14 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/sections/repository_add/repository_add.test.tsx` — 1 passed Assisted with Claude Code using Claude 4.6 Opus Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nit tests (elastic#258974) Closes elastic#248548 - Migrates flaky `repository_add` client integration test to focused unit tests spread across the source files that own the functionality. - Removes the legacy `__jest__/client_integration/repository_add.test.ts` integration test. - Unskips the previously flaky settings validation test (now a pure function test — no timeouts possible). - The old integration test rendered the full app through a router with async HTTP mock layers, causing flaky 5000ms timeouts on CI (issue - The new unit tests render components directly with minimal mocks, use synchronous `fireEvent`, and test validation as pure function calls. - [Integration → unit test mapping (gist)](https://gist.github.com/kapral18/b6ccde9cbf84bc18c35fc356861aba50) - `node scripts/check_changes.ts` — passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/services/validation/validate_repository.test.ts` — 24 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/step_one.test.tsx` — 10 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/repository_form.test.tsx` — 14 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/sections/repository_add/repository_add.test.tsx` — 1 passed Assisted with Claude Code using Claude 4.6 Opus Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> (cherry picked from commit 6b62324)
…t to unit tests (#258974) (#260128) # Backport This will backport the following commits from `main` to `9.3`: - [[Snapshot Restore] Migrate flaky repository_add integration test to unit tests (#258974)](#258974) <!--- Backport version: 11.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Karen Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2026-03-27T12:37:40Z","message":"[Snapshot Restore] Migrate flaky repository_add integration test to unit tests (#258974)\n\nCloses #248548\n\n## Summary\n\n- Migrates flaky `repository_add` client integration test to focused\nunit tests spread across the source files that own the functionality.\n- Removes the legacy\n`__jest__/client_integration/repository_add.test.ts` integration test.\n- Unskips the previously flaky settings validation test (now a pure\nfunction test — no timeouts possible).\n\n## Rationale\n\n- The old integration test rendered the full app through a router with\nasync HTTP mock layers, causing flaky 5000ms timeouts on CI (issue\n#248548).\n- The new unit tests render components directly with minimal mocks, use\nsynchronous `fireEvent`, and test validation as pure function calls.\n\n## Coverage mapping\n\n- [Integration → unit test mapping\n(gist)](https://gist.github.com/kapral18/b6ccde9cbf84bc18c35fc356861aba50)\n\n## Test Plan\n\n- `node scripts/check_changes.ts` — passed\n- `yarn test:jest\nx-pack/platform/plugins/private/snapshot_restore/public/application/services/validation/validate_repository.test.ts`\n— 24 passed\n- `yarn test:jest\nx-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/step_one.test.tsx`\n— 10 passed\n- `yarn test:jest\nx-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/repository_form.test.tsx`\n— 14 passed\n- `yarn test:jest\nx-pack/platform/plugins/private/snapshot_restore/public/application/sections/repository_add/repository_add.test.tsx`\n— 1 passed\n\nAssisted with Claude Code using Claude 4.6 Opus\n\nCo-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>","sha":"6b62324cd6ebd0313558a9ce1b8051f7a72600b9","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Kibana Management","release_note:skip","Feature:Snapshot and Restore","backport:version","v9.4.0","v9.3.3"],"title":"[Snapshot Restore] Migrate flaky repository_add integration test to unit tests","number":258974,"url":"https://github.com/elastic/kibana/pull/258974","mergeCommit":{"message":"[Snapshot Restore] Migrate flaky repository_add integration test to unit tests (#258974)\n\nCloses #248548\n\n## Summary\n\n- Migrates flaky `repository_add` client integration test to focused\nunit tests spread across the source files that own the functionality.\n- Removes the legacy\n`__jest__/client_integration/repository_add.test.ts` integration test.\n- Unskips the previously flaky settings validation test (now a pure\nfunction test — no timeouts possible).\n\n## Rationale\n\n- The old integration test rendered the full app through a router with\nasync HTTP mock layers, causing flaky 5000ms timeouts on CI (issue\n#248548).\n- The new unit tests render components directly with minimal mocks, use\nsynchronous `fireEvent`, and test validation as pure function calls.\n\n## Coverage mapping\n\n- [Integration → unit test mapping\n(gist)](https://gist.github.com/kapral18/b6ccde9cbf84bc18c35fc356861aba50)\n\n## Test Plan\n\n- `node scripts/check_changes.ts` — passed\n- `yarn test:jest\nx-pack/platform/plugins/private/snapshot_restore/public/application/services/validation/validate_repository.test.ts`\n— 24 passed\n- `yarn test:jest\nx-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/step_one.test.tsx`\n— 10 passed\n- `yarn test:jest\nx-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/repository_form.test.tsx`\n— 14 passed\n- `yarn test:jest\nx-pack/platform/plugins/private/snapshot_restore/public/application/sections/repository_add/repository_add.test.tsx`\n— 1 passed\n\nAssisted with Claude Code using Claude 4.6 Opus\n\nCo-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>","sha":"6b62324cd6ebd0313558a9ce1b8051f7a72600b9"}},"sourceBranch":"main","suggestedTargetBranches":["9.3"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258974","number":258974,"mergeCommit":{"message":"[Snapshot Restore] Migrate flaky repository_add integration test to unit tests (#258974)\n\nCloses #248548\n\n## Summary\n\n- Migrates flaky `repository_add` client integration test to focused\nunit tests spread across the source files that own the functionality.\n- Removes the legacy\n`__jest__/client_integration/repository_add.test.ts` integration test.\n- Unskips the previously flaky settings validation test (now a pure\nfunction test — no timeouts possible).\n\n## Rationale\n\n- The old integration test rendered the full app through a router with\nasync HTTP mock layers, causing flaky 5000ms timeouts on CI (issue\n#248548).\n- The new unit tests render components directly with minimal mocks, use\nsynchronous `fireEvent`, and test validation as pure function calls.\n\n## Coverage mapping\n\n- [Integration → unit test mapping\n(gist)](https://gist.github.com/kapral18/b6ccde9cbf84bc18c35fc356861aba50)\n\n## Test Plan\n\n- `node scripts/check_changes.ts` — passed\n- `yarn test:jest\nx-pack/platform/plugins/private/snapshot_restore/public/application/services/validation/validate_repository.test.ts`\n— 24 passed\n- `yarn test:jest\nx-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/step_one.test.tsx`\n— 10 passed\n- `yarn test:jest\nx-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/repository_form.test.tsx`\n— 14 passed\n- `yarn test:jest\nx-pack/platform/plugins/private/snapshot_restore/public/application/sections/repository_add/repository_add.test.tsx`\n— 1 passed\n\nAssisted with Claude Code using Claude 4.6 Opus\n\nCo-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>","sha":"6b62324cd6ebd0313558a9ce1b8051f7a72600b9"}},{"branch":"9.3","label":"v9.3.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nit tests (elastic#258974) Closes elastic#248548 ## Summary - Migrates flaky `repository_add` client integration test to focused unit tests spread across the source files that own the functionality. - Removes the legacy `__jest__/client_integration/repository_add.test.ts` integration test. - Unskips the previously flaky settings validation test (now a pure function test — no timeouts possible). ## Rationale - The old integration test rendered the full app through a router with async HTTP mock layers, causing flaky 5000ms timeouts on CI (issue elastic#248548). - The new unit tests render components directly with minimal mocks, use synchronous `fireEvent`, and test validation as pure function calls. ## Coverage mapping - [Integration → unit test mapping (gist)](https://gist.github.com/kapral18/b6ccde9cbf84bc18c35fc356861aba50) ## Test Plan - `node scripts/check_changes.ts` — passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/services/validation/validate_repository.test.ts` — 24 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/step_one.test.tsx` — 10 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/repository_form.test.tsx` — 14 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/sections/repository_add/repository_add.test.tsx` — 1 passed Assisted with Claude Code using Claude 4.6 Opus Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nit tests (elastic#258974) Closes elastic#248548 ## Summary - Migrates flaky `repository_add` client integration test to focused unit tests spread across the source files that own the functionality. - Removes the legacy `__jest__/client_integration/repository_add.test.ts` integration test. - Unskips the previously flaky settings validation test (now a pure function test — no timeouts possible). ## Rationale - The old integration test rendered the full app through a router with async HTTP mock layers, causing flaky 5000ms timeouts on CI (issue elastic#248548). - The new unit tests render components directly with minimal mocks, use synchronous `fireEvent`, and test validation as pure function calls. ## Coverage mapping - [Integration → unit test mapping (gist)](https://gist.github.com/kapral18/b6ccde9cbf84bc18c35fc356861aba50) ## Test Plan - `node scripts/check_changes.ts` — passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/services/validation/validate_repository.test.ts` — 24 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/step_one.test.tsx` — 10 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/repository_form.test.tsx` — 14 passed - `yarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/sections/repository_add/repository_add.test.tsx` — 1 passed Assisted with Claude Code using Claude 4.6 Opus Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Closes #248548
Summary
repository_addclient integration test to focused unit tests spread across the source files that own the functionality.__jest__/client_integration/repository_add.test.tsintegration test.Rationale
fireEvent, and test validation as pure function calls.Coverage mapping
Test Plan
node scripts/check_changes.ts— passedyarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/services/validation/validate_repository.test.ts— 24 passedyarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/step_one.test.tsx— 10 passedyarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/components/repository_form/repository_form.test.tsx— 14 passedyarn test:jest x-pack/platform/plugins/private/snapshot_restore/public/application/sections/repository_add/repository_add.test.tsx— 1 passedAssisted with Claude Code using Claude 4.6 Opus