Skip to content

[Upgrade Assistant] Migrate ES deprecations flaky integration tests to unit tests#258142

Merged
kapral18 merged 9 commits intoelastic:mainfrom
kapral18:chore/upgrade-assistant/fix-es-deprecations-flaky-tests-257356
Mar 26, 2026
Merged

[Upgrade Assistant] Migrate ES deprecations flaky integration tests to unit tests#258142
kapral18 merged 9 commits intoelastic:mainfrom
kapral18:chore/upgrade-assistant/fix-es-deprecations-flaky-tests-257356

Conversation

@kapral18
Copy link
Copy Markdown
Contributor

@kapral18 kapral18 commented Mar 17, 2026

Summary

  • Migrates ES deprecations coverage from flaky client integration tests to focused unit tests.
  • Adds unit coverage for the ES deprecations page/table (refresh, counts, filters/search, pagination) and key deprecation types (default, index settings, cluster settings, ML snapshots, indices reindex/readonly actions, data streams migration).
  • Removes the legacy __jest__/client_integration/es_deprecations specs and harness.

Closes

Coverage mapping

Test plan

  • node scripts/check_changes.ts
  • yarn test:jest x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations
  • yarn test:type_check --project x-pack/platform/plugins/private/upgrade_assistant/tsconfig.json

Summary by CodeRabbit

  • Tests
    • Reorganized test infrastructure for Elasticsearch deprecations module, consolidating mock data into centralized fixtures and refactoring integration tests into focused unit tests for individual components and scenarios.

@kapral18 kapral18 requested a review from a team as a code owner March 17, 2026 14:55
@kapral18 kapral18 marked this pull request as draft March 17, 2026 15:25
@kapral18 kapral18 added Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// Feature:Upgrade Assistant release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels v9.4.0 v9.3.1 labels Mar 17, 2026
@kapral18 kapral18 force-pushed the chore/upgrade-assistant/fix-es-deprecations-flaky-tests-257356 branch from b43430c to 9f864dd Compare March 17, 2026 16:48
@kapral18
Copy link
Copy Markdown
Contributor Author

@coderabbitai review full

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 17, 2026

@kapral18 I'll redo the full review of this PR now.


🧠 Learnings used
Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T00:28:33.949Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/**/*.{ts,tsx,js} : Follow tool design principles, ECS/OTel compatibility, APM data types, parameter conventions, testing workflows, and complete the pre-merge checklist for Observability tools

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T00:28:33.949Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/**/test/api_integration_deployment_agnostic/apis/observability_agent_builder/**/*.{ts,tsx,js} : Write API integration tests following the test structure guidelines, use shared utilities, and verify proper execution of API integration tests for the Observability Agent Builder

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T03:54:46.342Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/**/*.{ts,tsx,js} : Follow API integration test structure guidelines and use shared utilities as documented in x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/AGENTS.md

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/test/security_solution_cypress/.cursor/rules/flaky_test_doctor.mdc:0-0
Timestamp: 2026-03-06T08:27:30.911Z
Learning: Applies to x-pack/solutions/security/test/security_solution_cypress/**/*.cy.ts : Use API-based setup and teardown instead of `esArchiver` when possible for better test performance and reliability

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/test/security_solution_cypress/.cursor/rules/flaky_test_doctor.mdc:0-0
Timestamp: 2026-03-06T00:27:42.746Z
Learning: Applies to x-pack/solutions/security/test/security_solution_cypress/**/*.cy.ts : Before deleting a Cypress test, verify that full duplicate coverage exists at API and/or unit test levels. Document the exact files and test names that provide coverage. If deletion is approved, also clean up orphaned code in tasks/, screens/, and objects/ files that were only used by the deleted test.

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/AGENTS.md:0-0
Timestamp: 2026-03-06T00:29:18.910Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/tools/**/*.{ts,tsx} : API integration tests for tools must be added to the tools test directory and cover filters, groupBy dimensions, and edge cases

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/test/security_solution_cypress/.cursor/rules/flaky_test_doctor.mdc:0-0
Timestamp: 2026-03-06T08:28:08.636Z
Learning: Applies to x-pack/solutions/security/test/security_solution_cypress/**/*.cy.ts : Never delete tests without verifying that functionality is still valid and no duplicate coverage exists at API or unit test levels

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/.cursor/rules/bug_validator.mdc:0-0
Timestamp: 2026-03-06T00:27:17.504Z
Learning: When tracking test coverage, search these locations: Cypress E2E in x-pack/solutions/security/test/security_solution_cypress/cypress/e2e/, Scout (Playwright) in x-pack/solutions/security/plugins/security_solution/test/scout/, API Integration tests in x-pack/test/security_solution_api_integration/ and x-pack/solutions/security/test/security_solution_api_integration/, co-located unit tests (.test.ts/.test.tsx next to source files).

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T00:29:27.191Z
Learning: Applies to x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/**/test/api_integration_deployment_agnostic/**/*.test.{ts,tsx,js} : Use shared API client from `../utils/agent_builder_client` with `createAgentBuilderApiClient(scoped)` for API integration tests

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/test/security_solution_cypress/.cursor/rules/flaky_test_doctor.mdc:0-0
Timestamp: 2026-03-06T00:27:42.746Z
Learning: Applies to x-pack/solutions/security/test/security_solution_cypress/**/*.cy.ts : For Cypress tests covering Security Solution features (Detection Engine, Timeline, Cases, Entity Analytics, Asset Management, AI Assistant, Attack Discovery), follow the Flaky Test Doctor analysis framework: verify functionality validity (Step 0), establish environment context (Step 1), check for duplicate coverage (Step 2), analyze testing layer (Step 3), classify bug vs flakiness (Step 4), then propose fixes (Step 5)
✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 17, 2026

@kapral18 I'll redo the full review of this PR now.


🧠 Learnings used
Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T00:28:33.949Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/**/*.{ts,tsx,js} : Follow tool design principles, ECS/OTel compatibility, APM data types, parameter conventions, testing workflows, and complete the pre-merge checklist for Observability tools

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T09:23:07.998Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/**/*.{ts,tsx,js} : Follow tool design principles, ECS/OTel compatibility, APM data types, parameter conventions, testing workflows, and pre-merge checklist for Observability tools as documented in server/tools/AGENTS.md

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T03:54:46.342Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/**/*.{ts,tsx,js} : Follow API integration test structure guidelines and use shared utilities as documented in x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/AGENTS.md

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T00:28:33.949Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/routes/ai_insights/**/*.{ts,tsx,js} : Ensure AI Insights implementation follows architecture of one-click AI Insights with prefetched context, hardcoded prompts, proper prompt design, UI integration, conversation handoff, and comprehensive testing

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T00:28:33.949Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/**/test/api_integration_deployment_agnostic/apis/observability_agent_builder/**/*.{ts,tsx,js} : Write API integration tests following the test structure guidelines, use shared utilities, and verify proper execution of API integration tests for the Observability Agent Builder

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T12:00:53.329Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/routes/ai_insights/**/*.{ts,tsx,js} : Follow AI Insights architecture guidelines including prefetched context, hardcoded prompts, prompt design, UI integration, conversation handoff, and testing as documented in server/routes/ai_insights/AGENTS.md

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/AGENTS.md:0-0
Timestamp: 2026-03-06T00:29:18.910Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/tools/**/*.{ts,tsx} : API integration tests for tools must be added to the tools test directory and cover filters, groupBy dimensions, and edge cases

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/AGENTS.md:0-0
Timestamp: 2026-03-06T00:29:18.910Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/**/*.{ts,tsx} : Tool descriptions should be action-oriented with the first sentence starting with verbs like "Retrieves...", "Identifies...", or "Analyzes..."

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T10:48:39.498Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/src/platform/packages/shared/kbn-synthtrace/src/scenarios/agent_builder/**/*.{ts,tsx,js} : Generate synthetic test data for tools and AI Insights using Synthtrace scenarios as documented in src/platform/packages/shared/kbn-synthtrace/src/scenarios/agent_builder/AGENTS.md

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/test/security_solution_cypress/.cursor/rules/flaky_test_doctor.mdc:0-0
Timestamp: 2026-03-06T00:27:42.746Z
Learning: Applies to x-pack/solutions/security/test/security_solution_cypress/**/*.cy.ts : For Cypress tests covering Security Solution features (Detection Engine, Timeline, Cases, Entity Analytics, Asset Management, AI Assistant, Attack Discovery), follow the Flaky Test Doctor analysis framework: verify functionality validity (Step 0), establish environment context (Step 1), check for duplicate coverage (Step 2), analyze testing layer (Step 3), classify bug vs flakiness (Step 4), then propose fixes (Step 5)

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/test/security_solution_cypress/.cursor/rules/flaky_test_doctor.mdc:0-0
Timestamp: 2026-03-06T08:27:30.911Z
Learning: Applies to x-pack/solutions/security/test/security_solution_cypress/**/*.cy.ts : Use API-based setup and teardown instead of `esArchiver` when possible for better test performance and reliability

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/test/security_solution_cypress/.cursor/rules/flaky_test_doctor.mdc:0-0
Timestamp: 2026-03-06T00:27:42.746Z
Learning: Applies to x-pack/solutions/security/test/security_solution_cypress/**/*.cy.ts : Before deleting a Cypress test, verify that full duplicate coverage exists at API and/or unit test levels. Document the exact files and test names that provide coverage. If deletion is approved, also clean up orphaned code in tasks/, screens/, and objects/ files that were only used by the deleted test.

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/test/security_solution_cypress/.cursor/rules/flaky_test_doctor.mdc:0-0
Timestamp: 2026-03-06T08:28:08.636Z
Learning: Applies to x-pack/solutions/security/test/security_solution_cypress/**/*.cy.ts : Never delete tests without verifying that functionality is still valid and no duplicate coverage exists at API or unit test levels

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/.cursor/rules/bug_validator.mdc:0-0
Timestamp: 2026-03-06T00:27:17.504Z
Learning: When tracking test coverage, search these locations: Cypress E2E in x-pack/solutions/security/test/security_solution_cypress/cypress/e2e/, Scout (Playwright) in x-pack/solutions/security/plugins/security_solution/test/scout/, API Integration tests in x-pack/test/security_solution_api_integration/ and x-pack/solutions/security/test/security_solution_api_integration/, co-located unit tests (.test.ts/.test.tsx next to source files).

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T00:29:27.191Z
Learning: Applies to x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/**/test/api_integration_deployment_agnostic/**/*.test.{ts,tsx,js} : Use shared API client from `../utils/agent_builder_client` with `createAgentBuilderApiClient(scoped)` for API integration tests
✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 17, 2026

@kapral18 I'll redo the full review of this PR now.


🧠 Learnings used
Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T09:23:07.998Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/**/*.{ts,tsx,js} : Follow tool design principles, ECS/OTel compatibility, APM data types, parameter conventions, testing workflows, and pre-merge checklist for Observability tools as documented in server/tools/AGENTS.md

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T00:28:33.949Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/**/*.{ts,tsx,js} : Follow tool design principles, ECS/OTel compatibility, APM data types, parameter conventions, testing workflows, and complete the pre-merge checklist for Observability tools

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T03:54:46.342Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/**/*.{ts,tsx,js} : Follow API integration test structure guidelines and use shared utilities as documented in x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/AGENTS.md

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T00:28:33.949Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/**/test/api_integration_deployment_agnostic/apis/observability_agent_builder/**/*.{ts,tsx,js} : Write API integration tests following the test structure guidelines, use shared utilities, and verify proper execution of API integration tests for the Observability Agent Builder

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T00:28:33.949Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/routes/ai_insights/**/*.{ts,tsx,js} : Ensure AI Insights implementation follows architecture of one-click AI Insights with prefetched context, hardcoded prompts, proper prompt design, UI integration, conversation handoff, and comprehensive testing

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T12:00:53.329Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/routes/ai_insights/**/*.{ts,tsx,js} : Follow AI Insights architecture guidelines including prefetched context, hardcoded prompts, prompt design, UI integration, conversation handoff, and testing as documented in server/routes/ai_insights/AGENTS.md

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/AGENTS.md:0-0
Timestamp: 2026-03-06T00:29:18.910Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/tools/x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/tools/**/*.{ts,tsx} : API integration tests for tools must be added to the tools test directory and cover filters, groupBy dimensions, and edge cases

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T10:48:39.498Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/src/platform/packages/shared/kbn-synthtrace/src/scenarios/agent_builder/**/*.{ts,tsx,js} : Generate synthetic test data for tools and AI Insights using Synthtrace scenarios as documented in src/platform/packages/shared/kbn-synthtrace/src/scenarios/agent_builder/AGENTS.md

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/plugins/observability_agent_builder/server/routes/ai_insights/AGENTS.md:0-0
Timestamp: 2026-03-06T11:23:32.588Z
Learning: Applies to x-pack/solutions/observability/plugins/observability_agent_builder/server/routes/ai_insights/x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/ai_insights/**/*.ts : Each AI Insights type should have corresponding API tests in x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/ai_insights/

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T00:29:27.191Z
Learning: Applies to x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/**/test/api_integration_deployment_agnostic/**/*.test.{ts,tsx,js} : Use tool ID in describe block name with format `describe(\`tool: ${OBSERVABILITY_GET_*_TOOL_ID}\`, ...)`

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/test/security_solution_cypress/.cursor/rules/flaky_test_doctor.mdc:0-0
Timestamp: 2026-03-06T08:27:30.911Z
Learning: Applies to x-pack/solutions/security/test/security_solution_cypress/**/*.cy.ts : Use API-based setup and teardown instead of `esArchiver` when possible for better test performance and reliability

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/test/security_solution_cypress/.cursor/rules/flaky_test_doctor.mdc:0-0
Timestamp: 2026-03-06T00:27:42.746Z
Learning: Applies to x-pack/solutions/security/test/security_solution_cypress/**/*.cy.ts : Before deleting a Cypress test, verify that full duplicate coverage exists at API and/or unit test levels. Document the exact files and test names that provide coverage. If deletion is approved, also clean up orphaned code in tasks/, screens/, and objects/ files that were only used by the deleted test.

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/test/security_solution_cypress/.cursor/rules/flaky_test_doctor.mdc:0-0
Timestamp: 2026-03-06T08:28:08.636Z
Learning: Applies to x-pack/solutions/security/test/security_solution_cypress/**/*.cy.ts : Never delete tests without verifying that functionality is still valid and no duplicate coverage exists at API or unit test levels

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/.cursor/rules/bug_validator.mdc:0-0
Timestamp: 2026-03-06T00:27:17.504Z
Learning: When tracking test coverage, search these locations: Cypress E2E in x-pack/solutions/security/test/security_solution_cypress/cypress/e2e/, Scout (Playwright) in x-pack/solutions/security/plugins/security_solution/test/scout/, API Integration tests in x-pack/test/security_solution_api_integration/ and x-pack/solutions/security/test/security_solution_api_integration/, co-located unit tests (.test.ts/.test.tsx next to source files).

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/AGENTS.md:0-0
Timestamp: 2026-03-06T00:29:27.191Z
Learning: Applies to x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/observability_agent_builder/**/test/api_integration_deployment_agnostic/**/*.test.{ts,tsx,js} : Use shared API client from `../utils/agent_builder_client` with `createAgentBuilderApiClient(scoped)` for API integration tests

Learnt from: CR
Repo: elastic/kibana PR: 0
File: x-pack/solutions/security/test/security_solution_cypress/.cursor/rules/flaky_test_doctor.mdc:0-0
Timestamp: 2026-03-06T00:27:42.746Z
Learning: Applies to x-pack/solutions/security/test/security_solution_cypress/**/*.cy.ts : For Cypress tests covering Security Solution features (Detection Engine, Timeline, Cases, Entity Analytics, Asset Management, AI Assistant, Attack Discovery), follow the Flaky Test Doctor analysis framework: verify functionality validity (Step 0), establish environment context (Step 1), check for duplicate coverage (Step 2), analyze testing layer (Step 3), classify bug vs flakiness (Step 4), then propose fixes (Step 5)
✅ Actions performed

Full review triggered.

@kapral18
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 17, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

The pull request migrates ES deprecations tests from client integration tests to unit tests with fixtures. It removes timeout-prone integration test files and replaces them with isolated unit tests colocated with component implementations, introducing centralized mock data fixtures to support the new test architecture.

Changes

Cohort / File(s) Summary
Integration test removals
__jest__/client_integration/es_deprecations/*.test.ts, __jest__/client_integration/es_deprecations/es_deprecations.helpers.tsx, __jest__/client_integration/es_deprecations/mocked_responses.ts
Removed 10 integration/client test files and supporting utilities that suffered from timeout issues. Eliminates page-level test setup, mocked HTTP responses, and shared helpers.
ES deprecations fixture
public/application/components/es_deprecations/__fixtures__/es_deprecations.ts
New centralized mock data module exporting deprecation constants (mlDeprecation, indexSettingDeprecation, clusterSettingDeprecation, defaultDeprecation, reindexDeprecation) and a factory function createEsDeprecations for generating test data with configurable counts.
Cluster settings unit tests
public/application/components/es_deprecations/deprecation_types/cluster_settings/*.test.tsx
New component unit tests for cluster settings deprecation flyout and table row, covering rendering, removal actions, success/error states, and UI updates.
Index settings unit tests
public/application/components/es_deprecations/deprecation_types/index_settings/*.test.tsx
New component unit tests for index settings deprecation flyout and table row, verifying UI rendering and settings removal workflows with success/failure scenarios.
ML snapshots unit tests
public/application/components/es_deprecations/deprecation_types/ml_snapshots/flyout.test.tsx
New unit test for snapshot upgrade/delete flows, upgrade mode behavior, and error handling within the ML snapshots flyout component.
Default deprecation unit tests
public/application/components/es_deprecations/deprecation_types/default/*.test.tsx
New component unit tests for default deprecation flyout and table row, verifying basic rendering and flyout opening interaction.
Data streams unit tests
public/application/components/es_deprecations/deprecation_types/data_streams/**/*.test.tsx
New comprehensive unit tests for data streams reindex and readonly workflows, including actions cell, flyout steps (confirm, checklist, progress), and resolution cell display logic.
Indices reindex unit tests
public/application/components/es_deprecations/deprecation_types/indices/**/*.test.tsx
New unit tests for reindex and readonly migration UI components, including actions cell, warning modal, and resolution recommendations across various index states.
Common unit tests and main component
public/application/components/es_deprecations/common/nodes_low_disk_space.test.tsx, public/application/components/es_deprecations/es_deprecations.test.tsx, public/application/components/es_deprecations/es_deprecations_table.test.tsx
New unit tests for shared components and main deprecations page, covering loading states, error scenarios, filtering, pagination, and data display logic.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Suggested labels

chore, reviewer:coderabbit

Suggested reviewers

  • jbudz
  • kowalczyk-krzysztof
  • jughosta
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: migrating ES deprecations tests from flaky client integration tests to unit tests.
Linked Issues check ✅ Passed The PR successfully addresses all four linked issues (#241740, #248431, #248433, #257356) by removing the flaky integration tests and replacing them with stable unit tests covering the same functionality.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the objectives: removing flaky integration tests and adding corresponding unit tests. No unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_modal.test.tsx (1)

106-122: ⚠️ Potential issue | 🟠 Major

Reset shared baseProps mocks per test to avoid false positives.

baseProps.confirm and baseProps.closeModal are shared across test cases. Without resetting, prior calls can make later toHaveBeenCalled() assertions pass even if the current interaction is broken (e.g., Line 141-152 vs Line 167-179).

Proposed fix
 describe('WarningModalStep', () => {
+  beforeEach(() => {
+    baseProps.confirm.mockReset();
+    baseProps.closeModal.mockReset();
+  });
+
   it('renders read-only modal and disables continue until all checkboxes are checked', () => {

Also applies to: 124-187

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_modal.test.tsx`
around lines 106 - 122, Tests share mutable baseProps with jest.fn() mocks
(baseProps.confirm and baseProps.closeModal), causing cross-test leakage; fix by
resetting or recreating these mocks between tests—either call
jest.clearAllMocks()/jest.resetAllMocks() in a beforeEach/afterEach or replace
baseProps with a factory getBaseProps() that returns fresh jest.fn() instances
used by each test; update tests that reference baseProps (and assertions that
call toHaveBeenCalled()) to use the fresh mocks so prior test calls cannot cause
false positives.
🧹 Nitpick comments (2)
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/es_deprecations.ts (1)

102-121: createEsDeprecations should include cluster settings to match “per type” intent.

The helper currently generates four types even though this fixture module defines five migration deprecation types, which can underrepresent table datasets.

Proposed diff
 export const createEsDeprecations = (numDeprecationsPerType: number): ESUpgradeStatus => {
   const repeat = (deprecation: EnrichedDeprecationInfo) =>
     Array.from({ length: numDeprecationsPerType }, () => deprecation);

   const mlDeprecations = repeat(mockMlDeprecation);
   const indexSettingsDeprecations = repeat(mockIndexSettingDeprecation);
   const reindexDeprecations = repeat(mockReindexDeprecation);
   const defaultDeprecations = repeat(mockDefaultDeprecation);
+  const clusterSettingDeprecations = repeat(mockClusterSettingDeprecation);

   return {
     totalCriticalDeprecations: mlDeprecations.length + reindexDeprecations.length,
     migrationsDeprecations: [
       ...defaultDeprecations,
       ...reindexDeprecations,
       ...indexSettingsDeprecations,
+      ...clusterSettingDeprecations,
       ...mlDeprecations,
     ],
     totalCriticalHealthIssues: mockEsDeprecations.totalCriticalHealthIssues,
     enrichedHealthIndicators: mockEsDeprecations.enrichedHealthIndicators,
   };
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/es_deprecations.ts`
around lines 102 - 121, createEsDeprecations currently builds only four
deprecation type lists (ml, indexSettings, reindex, default) but the fixture
defines five migration deprecation types; add a repeated cluster settings list
using mockClusterSettingDeprecation (e.g., const clusterSettingsDeprecations =
repeat(mockClusterSettingDeprecation)), include it in the migrationsDeprecations
spread array, and include its length in totalCriticalDeprecations calculation
(alongside mlDeprecations and reindexDeprecations) so the helper truly generates
deprecations "per type."
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/table_row.test.tsx (1)

124-145: Tighten the failure-path contract with one side-effect assertion.

The failed-removal test checks the status text, but it should also assert intended flyout behavior on failure (e.g., whether removeContent is called or not) to prevent regressions in UX flow.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/table_row.test.tsx`
around lines 124 - 145, The test currently asserts the resolution text but
misses verifying flyout behavior on failure; after calling
removeIndexSettings('my_index', [...]) grab the removeContent prop from
mockAddContent.mock.calls[0][0].props (same place you extracted
removeIndexSettings) and add an assertion that removeContent was not called
(expect(removeContent).not.toHaveBeenCalled()) to lock down the failure-path UX;
keep this assertion adjacent to the existing resolutionCell expectation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/cluster_settings/flyout.test.tsx`:
- Around line 33-54: Add an assertion that the flyout body renders the
deprecation details string: in the test for RemoveClusterSettingsFlyout use
mockClusterSettingDeprecation.details and assert
screen.getByTestId('flyoutBody') (or the existing body test id)
hasTextContent(mockClusterSettingDeprecation.details) so the test verifies the
body text in addition to title, link and button.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.test.tsx`:
- Around line 92-104: The test "shows no deprecations prompt" uses
mockUseLoadEsDeprecations with mockEsDeprecations but only overrides
migrationsDeprecations, leaving totalCriticalDeprecations (and other aggregate
counts) non-zero; update the fixture in this test so the returned data is
self-consistent by overriding the aggregate counts in mockUseLoadEsDeprecations
(e.g., set totalCriticalDeprecations and other total* fields to 0) or build a
new empty-state object instead of spreading mockEsDeprecations; change the call
site in the test that sets mockUseLoadEsDeprecations so the page sees consistent
totals for the no-deprecations scenario.

---

Outside diff comments:
In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_modal.test.tsx`:
- Around line 106-122: Tests share mutable baseProps with jest.fn() mocks
(baseProps.confirm and baseProps.closeModal), causing cross-test leakage; fix by
resetting or recreating these mocks between tests—either call
jest.clearAllMocks()/jest.resetAllMocks() in a beforeEach/afterEach or replace
baseProps with a factory getBaseProps() that returns fresh jest.fn() instances
used by each test; update tests that reference baseProps (and assertions that
call toHaveBeenCalled()) to use the fresh mocks so prior test calls cannot cause
false positives.

---

Nitpick comments:
In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/es_deprecations.ts`:
- Around line 102-121: createEsDeprecations currently builds only four
deprecation type lists (ml, indexSettings, reindex, default) but the fixture
defines five migration deprecation types; add a repeated cluster settings list
using mockClusterSettingDeprecation (e.g., const clusterSettingsDeprecations =
repeat(mockClusterSettingDeprecation)), include it in the migrationsDeprecations
spread array, and include its length in totalCriticalDeprecations calculation
(alongside mlDeprecations and reindexDeprecations) so the helper truly generates
deprecations "per type."

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/table_row.test.tsx`:
- Around line 124-145: The test currently asserts the resolution text but misses
verifying flyout behavior on failure; after calling
removeIndexSettings('my_index', [...]) grab the removeContent prop from
mockAddContent.mock.calls[0][0].props (same place you extracted
removeIndexSettings) and add an assertion that removeContent was not called
(expect(removeContent).not.toHaveBeenCalled()) to lock down the failure-path UX;
keep this assertion adjacent to the existing resolutionCell expectation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: f6978125-3df3-4e0f-8c60-34c98dbebdd6

📥 Commits

Reviewing files that changed from the base of the PR and between 9c151a6 and 9f864dd.

📒 Files selected for processing (32)
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/cluster_settings_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/data_streams_deprecation.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/default_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/deprecations_list.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/error_handling.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/es_deprecations.helpers.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/index_settings_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/ml_snapshots_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/mocked_responses.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/readonly_index_modal.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/reindex_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/es_deprecations.ts
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/common/nodes_low_disk_space.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/cluster_settings/flyout.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/cluster_settings/table_row.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/actions_table_cell.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/container.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/checklist_reindex_step.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/progress.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/readonly_confirm_step.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/reindex_confirm_step.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/resolution_table_cell.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/flyout.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/table_row.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/flyout.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/table_row.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/actions_table_cell.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_modal.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/resolution_table_cell.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/flyout.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.test.tsx
💤 Files with no reviewable changes (11)
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/default_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/cluster_settings_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/index_settings_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/es_deprecations.helpers.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/mocked_responses.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/reindex_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/error_handling.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/data_streams_deprecation.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/deprecations_list.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/readonly_index_modal.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/ml_snapshots_deprecation_flyout.test.ts

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 17, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

Removes client integration tests for ES deprecations module due to timeout failures, replacing them with focused unit tests for individual components. Consolidates mock data into a shared fixtures file. All test coverage is refactored from integration-style (full app setup, multiple component interactions) to unit-style (isolated components with mocks).

Changes

Cohort / File(s) Summary
Integration Test Removal
__jest__/client_integration/es_deprecations/*
Deleted all integration test files (11 test files + helpers + mocks) totaling ~3,239 lines. These tests set up full app environments with mocked HTTP responses and tested multi-component flows. Removal follows timeout failures in deprecated_list, cluster_settings_deprecation_flyout, data_streams_deprecation tests.
Mock Data Consolidation
__fixtures__/es_deprecations.ts
New fixture module exporting mock constants (MOCK_SNAPSHOT_ID, MOCK_JOB_ID) and mock deprecation objects (mockMlDeprecation, mockIndexSettingDeprecation, mockClusterSettingDeprecation, mockDefaultDeprecation, mockReindexDeprecation, mockEsDeprecations) plus createEsDeprecations factory. Replaces mocked_responses.ts functionality.
Cluster Settings Component Tests
deprecation_types/cluster_settings/flyout.test.tsx, deprecation_types/cluster_settings/table_row.test.tsx
New unit tests for RemoveClusterSettingsFlyout and ClusterSettingsTableRow components. Verify deletion workflows, error handling, UI state changes, and integration with global flyout context.
Data Streams Component Tests
deprecation_types/data_streams/actions_table_cell.test.tsx, deprecation_types/data_streams/flyout/container.test.tsx, deprecation_types/data_streams/flyout/steps/checklist/*, deprecation_types/data_streams/flyout/steps/confirm/*, deprecation_types/data_streams/resolution_table_cell.test.tsx
New unit tests for data stream reindex/readonly workflows. Test migration state management, checklist rendering, progress tracking, confirmation steps with warning checkboxes, and low disk space callouts.
Default & Index Settings Component Tests
deprecation_types/default/flyout.test.tsx, deprecation_types/default/table_row.test.tsx, deprecation_types/index_settings/flyout.test.tsx, deprecation_types/index_settings/table_row.test.tsx
New unit tests for default deprecation and index settings removal flows. Verify flyout rendering, documentation links, deletion interactions, error states, and UI updates for completion/failure scenarios.
Indices Component Tests
deprecation_types/indices/actions_table_cell.test.tsx, deprecation_types/indices/flyout/steps/warning/warning_step_modal.test.tsx, deprecation_types/indices/resolution_table_cell.test.tsx
New unit tests for reindex action cells, warning modals, and resolution recommendations. Covers action visibility based on state, mixed action scenarios, excluded actions, follower index handling, and typing improvements (LoadingState, explicit checkbox/callout signatures).
ML Snapshots Component Tests
deprecation_types/ml_snapshots/flyout.test.tsx
New unit test for FixSnapshotsFlyout covering upgrade/delete workflows, upgrade mode enabled state, error handling, and user interactions.
Page-Level Component Tests
es_deprecations.test.tsx, es_deprecations_table.test.tsx, common/nodes_low_disk_space.test.tsx
New unit tests for EsDeprecations page, EsDeprecationsTable component, and NodesLowSpaceCallOut. Verify loading states, error scenarios (403, 426 upgrade required, 500), remote clusters callout, pagination, filtering, search, and row stability across pages.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested labels

chore, backport:skip

Suggested reviewers

  • flash1293
  • CoenWarmer
  • jbudz
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: migrating flaky integration tests to unit tests for ES deprecations.
Linked Issues check ✅ Passed All linked issues (#241740, #248431, #248433, #257356) document failing client integration tests with timeout errors. The PR addresses these by removing flaky integration tests and replacing them with focused unit tests.
Out of Scope Changes check ✅ Passed All changes are directly related to the PR objective: removing flaky integration tests and adding comprehensive unit test coverage for ES deprecations functionality. No unrelated changes detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_modal.test.tsx (1)

106-122: ⚠️ Potential issue | 🟠 Major

Create fresh props per test instead of reusing shared mocks.

baseProps.confirm and baseProps.closeModal are singleton jest.fn()s, so the assertions on Lines 151, 178, and 185 can pass because an earlier test already called them. That makes this suite prone to false positives.

🧪 One simple isolation pattern
-const baseProps = {
+const createProps = () => ({
   closeModal: jest.fn(),
   confirm: jest.fn(),
   meta: {
     indexName: 'test-index',
     reindexName: 'test-index-reindex',
     aliases: [],
     isReadonly: false,
     isFrozen: false,
     isInDataStream: false,
     isFollowerIndex: false,
   },
   warnings: mockWarnings,
   deprecation: mockDeprecation,
   reindexState: mockReindexState,
   flow: 'readonly' as const,
-};
+});

Then instantiate const props = createProps(); inside each test and assert against props.confirm / props.closeModal with toHaveBeenCalledTimes(1).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_modal.test.tsx`
around lines 106 - 122, Tests reuse a single baseProps object so
baseProps.confirm and baseProps.closeModal are shared jest.fn() instances that
can retain call state across tests; change to a factory that returns fresh props
per test (e.g., createProps() that builds the same shape as baseProps but
creates new jest.fn() for confirm and closeModal and copies meta/warnings/etc.),
then in each test call const props = createProps() and mount/render with props
and assert props.confirm/toHaveBeenCalledTimes(1) and
props.closeModal/toHaveBeenCalledTimes(1) to ensure isolation; update any
references to baseProps in the tests to use the per-test props.
🧹 Nitpick comments (8)
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/checklist_reindex_step.test.tsx (1)

59-108: Optional: extract a small render helper to reduce duplication.

The repeated renderWithI18n(<ChecklistFlyoutStep ... />) setup can be centralized for easier future state-case additions.

♻️ Suggested refactor
+const renderStep = ({
+  migrationState,
+  executeAction = jest.fn(),
+  cancelAction = jest.fn(),
+} : {
+  migrationState: MigrationState;
+  executeAction?: jest.Mock;
+  cancelAction?: jest.Mock;
+}) =>
+  renderWithI18n(
+    <ChecklistFlyoutStep
+      closeFlyout={jest.fn()}
+      migrationState={migrationState}
+      executeAction={executeAction}
+      cancelAction={cancelAction}
+      dataStreamName="my-ds"
+    />
+  );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/checklist_reindex_step.test.tsx`
around lines 59 - 108, Tests repeat renderWithI18n(<ChecklistFlyoutStep ... />)
with different migrationState props; extract a small helper (e.g.,
renderChecklistFlyout) that takes migrationState, executeAction, cancelAction,
dataStreamName and calls renderWithI18n with ChecklistFlyoutStep to reduce
duplication and make future cases easier to add; update existing tests to call
renderChecklistFlyout(createMigrationState({...}), jest.fn(), cancelAction,
'my-ds') (or omit optional args) and keep assertions unchanged.
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/readonly_confirm_step.test.tsx (1)

20-97: Optional: extract shared confirm-step test scaffolding.

The mock context/meta/warnings setup is nearly identical to reindex_confirm_step.test.tsx; a shared helper would reduce divergence risk.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/readonly_confirm_step.test.tsx`
around lines 20 - 97, The test duplicates setup for mockLoadNodeDiskSpace,
useAppContext mock, jest.mock('./warnings'), NodesLowSpaceCallOut mock, plus
mockMeta and mockWarnings; extract these into a shared test helper (e.g., a new
factory function in a test utils module) and import it into both
readonly_confirm_step.test.tsx and reindex_confirm_step.test.tsx. Specifically,
move the mockLoadNodeDiskSpace definition, the useAppContext jest.mock block,
the warnings and NodesLowSpaceCallOut jest.mocks, and the mockMeta/mockWarnings
objects into a single exported helper (e.g., createConfirmStepTestScaffold or
getConfirmStepMocks) and replace the duplicated blocks in both tests with calls
to that helper and any needed per-test overrides. Ensure exported symbol names
match usage and that tests import the helper before any jest.mock calls.
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/resolution_table_cell.test.tsx (1)

43-57: Optional: extract shared migration-context mock factory in this file.

Both tests duplicate the same context payload; a local helper will keep the suite easier to extend.

♻️ Suggested refactor
+const createMockContext = (): MigrationStateContext => ({
+  loadDataStreamMetadata: jest.fn<Promise<void>, []>(),
+  initMigration: jest.fn<void, [resolutionType: 'reindex' | 'readonly']>(),
+  startReindex: jest.fn<Promise<void>, []>(),
+  cancelReindex: jest.fn<Promise<void>, []>(),
+  startReadonly: jest.fn<Promise<void>, []>(),
+  cancelReadonly: jest.fn<Promise<void>, []>(),
+  migrationState: {
+    loadingState: LoadingState.Success,
+    status: DataStreamMigrationStatus.notStarted,
+    taskPercComplete: null,
+    errorMessage: null,
+    meta: null,
+  },
+});
+
 it('recommends set to read-only by default', () => {
-  mockUseDataStreamMigrationContext.mockReturnValue({
-    ...
-  });
+  mockUseDataStreamMigrationContext.mockReturnValue(createMockContext());
   ...
 });
 ...
-  mockUseDataStreamMigrationContext.mockReturnValue({
-    ...
-  });
+  mockUseDataStreamMigrationContext.mockReturnValue(createMockContext());

Also applies to: 73-87

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/resolution_table_cell.test.tsx`
around lines 43 - 57, The two tests duplicate the same mock return value for
mockUseDataStreamMigrationContext; extract a shared factory helper (e.g.,
makeDefaultMigrationContextMock) that returns the object containing
loadDataStreamMetadata, initMigration, startReindex, cancelReindex,
startReadonly, cancelReadonly and migrationState (with LoadingState.Success and
DataStreamMigrationStatus.notStarted) and use it in both places instead of
repeating the literal; update each
mockUseDataStreamMigrationContext.mockReturnValue(...) call to call the new
factory so future changes to the migration context shape are centralized.
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/container.test.tsx (1)

59-60: Consider reducing formatter-coupling in the test constants.

DATE_FORMAT and FILE_SIZE_DISPLAY_FORMAT duplicated in tests can drift from component formatting. If feasible, share exported constants or assert less brittle output characteristics.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/container.test.tsx`
around lines 59 - 60, The test is tightly coupled to DATE_FORMAT and
FILE_SIZE_DISPLAY_FORMAT constants; either import the canonical formatter
constants from the component/formatting module where they are defined (instead
of duplicating them in container.test.tsx) by replacing the local
DATE_FORMAT/FILE_SIZE_DISPLAY_FORMAT with imports, or make assertions less
brittle by matching only stable parts (e.g., use regex or substring checks for
date tokens or use human-readable size prefixes like "KB"/"MB" rather than full
formatted string) so changes to formatter specifics won't break tests; update
the test to reference the imported constants or to use the relaxed assertions
accordingly.
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.test.tsx (1)

203-205: Make the long error-copy assertion less brittle.

Line 204 currently asserts a full sentence verbatim; minor copy edits will fail the test even if behavior is unchanged. Prefer matching a stable fragment.

♻️ Suggested assertion tweak
-    expect(await screen.findByTestId('deprecationsPageLoadingError')).toHaveTextContent(
-      'Upgrade Kibana to the same version as your Elasticsearch cluster. One or more nodes in the cluster is running a different version than Kibana.'
-    );
+    expect(await screen.findByTestId('deprecationsPageLoadingError')).toHaveTextContent(
+      /Upgrade Kibana to the same version as your Elasticsearch cluster/i
+    );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.test.tsx`
around lines 203 - 205, The test's assertion in es_deprecations.test.tsx is
brittle because it matches the entire long error message; change the expectation
that uses screen.findByTestId('deprecationsPageLoadingError') to assert a stable
fragment (e.g., match a short substring or a regex) instead of the full sentence
so minor copy edits won't break the test — update the assertion around the
deprecationsPageLoadingError lookup to use a fragment match like /Upgrade Kibana
to the same version/ or similar.
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/resolution_table_cell.test.tsx (1)

31-75: Extract duplicated context factories to a shared test utility.

createReindexState, createUpdateIndexState, and createIndexContext are duplicated here and in deprecation_types/indices/actions_table_cell.test.tsx. Consolidating them will reduce drift and simplify future updates.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/resolution_table_cell.test.tsx`
around lines 31 - 75, Extract the duplicated test factories createReindexState,
createUpdateIndexState, and createIndexContext into a single shared test utility
module and replace the local copies with imports; specifically, move the
implementations to a new exported helper (e.g.,
testHelpers/createIndexStateHelpers) and update both tests that currently define
them to import createReindexState, createUpdateIndexState, and
createIndexContext from that module, keeping signatures and jest.fn calls intact
so existing tests that call startReindex, cancelReindex, and updateIndex
continue to work.
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.test.tsx (1)

64-67: Avoid deriving page counts from EUI CSS classes.

Line 66 couples the suite to .euiPagination__item, so a markup-only change in EUI can break most of these tests without any Upgrade Assistant regression. Prefer counting pagination controls via role or a stable data-test-subj under the container from Line 65.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.test.tsx`
around lines 64 - 67, The test's getPaginationItemsCount function currently
relies on the EUI CSS class '.euiPagination__item', which is fragile; update it
to count pagination controls using an accessible/query selector instead (e.g.,
use
within(screen.getByTestId('esDeprecationsPagination')).getAllByRole('button') or
querySelectorAll on a stable data-test-subj under the pagination container) so
the test uses role or a dedicated data-test-subj rather than the EUI markup
class; modify the getPaginationItemsCount implementation and any related
expectations to use that stable selector and the existing
screen/getByTestId('esDeprecationsPagination') call.
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/es_deprecations.ts (1)

102-121: Generate fresh rows from the canonical fixture set.

Line 103 currently aliases the same object into every slot, which makes the generated dataset less representative and can hide identity/state bugs in the pagination tests that consume this helper. I’d also derive from mockEsDeprecations.migrationsDeprecations here so new base fixtures like mockClusterSettingDeprecation are not silently skipped.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/es_deprecations.ts`
around lines 102 - 121, The createEsDeprecations function currently repeats the
exact same object references for each deprecation type, which reduces test data
variability and can hide issues. To fix this, generate fresh copies for each
item by mapping over the original mockEsDeprecations.migrationsDeprecations
array and creating new instances or clones of each item to ensure unique
references. This approach will also include new base fixtures like
mockClusterSettingDeprecation and produce a more representative dataset for
pagination tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_modal.test.tsx`:
- Around line 106-122: Tests reuse a single baseProps object so
baseProps.confirm and baseProps.closeModal are shared jest.fn() instances that
can retain call state across tests; change to a factory that returns fresh props
per test (e.g., createProps() that builds the same shape as baseProps but
creates new jest.fn() for confirm and closeModal and copies meta/warnings/etc.),
then in each test call const props = createProps() and mount/render with props
and assert props.confirm/toHaveBeenCalledTimes(1) and
props.closeModal/toHaveBeenCalledTimes(1) to ensure isolation; update any
references to baseProps in the tests to use the per-test props.

---

Nitpick comments:
In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/es_deprecations.ts`:
- Around line 102-121: The createEsDeprecations function currently repeats the
exact same object references for each deprecation type, which reduces test data
variability and can hide issues. To fix this, generate fresh copies for each
item by mapping over the original mockEsDeprecations.migrationsDeprecations
array and creating new instances or clones of each item to ensure unique
references. This approach will also include new base fixtures like
mockClusterSettingDeprecation and produce a more representative dataset for
pagination tests.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/container.test.tsx`:
- Around line 59-60: The test is tightly coupled to DATE_FORMAT and
FILE_SIZE_DISPLAY_FORMAT constants; either import the canonical formatter
constants from the component/formatting module where they are defined (instead
of duplicating them in container.test.tsx) by replacing the local
DATE_FORMAT/FILE_SIZE_DISPLAY_FORMAT with imports, or make assertions less
brittle by matching only stable parts (e.g., use regex or substring checks for
date tokens or use human-readable size prefixes like "KB"/"MB" rather than full
formatted string) so changes to formatter specifics won't break tests; update
the test to reference the imported constants or to use the relaxed assertions
accordingly.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/checklist_reindex_step.test.tsx`:
- Around line 59-108: Tests repeat renderWithI18n(<ChecklistFlyoutStep ... />)
with different migrationState props; extract a small helper (e.g.,
renderChecklistFlyout) that takes migrationState, executeAction, cancelAction,
dataStreamName and calls renderWithI18n with ChecklistFlyoutStep to reduce
duplication and make future cases easier to add; update existing tests to call
renderChecklistFlyout(createMigrationState({...}), jest.fn(), cancelAction,
'my-ds') (or omit optional args) and keep assertions unchanged.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/readonly_confirm_step.test.tsx`:
- Around line 20-97: The test duplicates setup for mockLoadNodeDiskSpace,
useAppContext mock, jest.mock('./warnings'), NodesLowSpaceCallOut mock, plus
mockMeta and mockWarnings; extract these into a shared test helper (e.g., a new
factory function in a test utils module) and import it into both
readonly_confirm_step.test.tsx and reindex_confirm_step.test.tsx. Specifically,
move the mockLoadNodeDiskSpace definition, the useAppContext jest.mock block,
the warnings and NodesLowSpaceCallOut jest.mocks, and the mockMeta/mockWarnings
objects into a single exported helper (e.g., createConfirmStepTestScaffold or
getConfirmStepMocks) and replace the duplicated blocks in both tests with calls
to that helper and any needed per-test overrides. Ensure exported symbol names
match usage and that tests import the helper before any jest.mock calls.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/resolution_table_cell.test.tsx`:
- Around line 43-57: The two tests duplicate the same mock return value for
mockUseDataStreamMigrationContext; extract a shared factory helper (e.g.,
makeDefaultMigrationContextMock) that returns the object containing
loadDataStreamMetadata, initMigration, startReindex, cancelReindex,
startReadonly, cancelReadonly and migrationState (with LoadingState.Success and
DataStreamMigrationStatus.notStarted) and use it in both places instead of
repeating the literal; update each
mockUseDataStreamMigrationContext.mockReturnValue(...) call to call the new
factory so future changes to the migration context shape are centralized.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/resolution_table_cell.test.tsx`:
- Around line 31-75: Extract the duplicated test factories createReindexState,
createUpdateIndexState, and createIndexContext into a single shared test utility
module and replace the local copies with imports; specifically, move the
implementations to a new exported helper (e.g.,
testHelpers/createIndexStateHelpers) and update both tests that currently define
them to import createReindexState, createUpdateIndexState, and
createIndexContext from that module, keeping signatures and jest.fn calls intact
so existing tests that call startReindex, cancelReindex, and updateIndex
continue to work.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.test.tsx`:
- Around line 64-67: The test's getPaginationItemsCount function currently
relies on the EUI CSS class '.euiPagination__item', which is fragile; update it
to count pagination controls using an accessible/query selector instead (e.g.,
use
within(screen.getByTestId('esDeprecationsPagination')).getAllByRole('button') or
querySelectorAll on a stable data-test-subj under the pagination container) so
the test uses role or a dedicated data-test-subj rather than the EUI markup
class; modify the getPaginationItemsCount implementation and any related
expectations to use that stable selector and the existing
screen/getByTestId('esDeprecationsPagination') call.

In
`@x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.test.tsx`:
- Around line 203-205: The test's assertion in es_deprecations.test.tsx is
brittle because it matches the entire long error message; change the expectation
that uses screen.findByTestId('deprecationsPageLoadingError') to assert a stable
fragment (e.g., match a short substring or a regex) instead of the full sentence
so minor copy edits won't break the test — update the assertion around the
deprecationsPageLoadingError lookup to use a fragment match like /Upgrade Kibana
to the same version/ or similar.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 4278d872-707b-4012-8796-8988af172604

📥 Commits

Reviewing files that changed from the base of the PR and between 9c151a6 and 9f864dd.

📒 Files selected for processing (32)
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/cluster_settings_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/data_streams_deprecation.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/default_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/deprecations_list.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/error_handling.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/es_deprecations.helpers.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/index_settings_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/ml_snapshots_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/mocked_responses.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/readonly_index_modal.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/reindex_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/es_deprecations.ts
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/common/nodes_low_disk_space.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/cluster_settings/flyout.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/cluster_settings/table_row.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/actions_table_cell.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/container.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/checklist_reindex_step.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/progress.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/readonly_confirm_step.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/reindex_confirm_step.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/resolution_table_cell.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/flyout.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/table_row.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/flyout.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/table_row.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/actions_table_cell.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_modal.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/resolution_table_cell.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/flyout.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.test.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.test.tsx
💤 Files with no reviewable changes (11)
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/default_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/index_settings_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/es_deprecations.helpers.tsx
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/mocked_responses.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/deprecations_list.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/error_handling.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/ml_snapshots_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/cluster_settings_deprecation_flyout.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/readonly_index_modal.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/data_streams_deprecation.test.ts
  • x-pack/platform/plugins/private/upgrade_assistant/jest/client_integration/es_deprecations/reindex_deprecation_flyout.test.ts

@kapral18 kapral18 force-pushed the chore/upgrade-assistant/fix-es-deprecations-flaky-tests-257356 branch from d6e1b3a to ab7ae67 Compare March 18, 2026 21:07
@kapral18 kapral18 marked this pull request as ready for review March 18, 2026 21:10
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-management (Team:Kibana Management)

@kapral18 kapral18 force-pushed the chore/upgrade-assistant/fix-es-deprecations-flaky-tests-257356 branch 3 times, most recently from b6fb605 to bfdd96d Compare March 19, 2026 18:28
@kapral18 kapral18 added v9.3.3 and removed v9.3.1 labels Mar 22, 2026
@kapral18 kapral18 force-pushed the chore/upgrade-assistant/fix-es-deprecations-flaky-tests-257356 branch 2 times, most recently from 9126586 to a62a409 Compare March 23, 2026 16:43
## Summary

Adds RTL unit tests and shared fixtures for the Elasticsearch deprecations page and table behaviors (loading/prompt/errors, refresh, counts, filtering/search, and pagination).

## Test plan

- [x] node scripts/check_changes.ts
- [x] yarn test:jest x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations
- [x] yarn test:type_check --project x-pack/platform/plugins/private/upgrade_assistant/tsconfig.json

Made-with: Cursor
## Summary

Adds unit tests for shared low-disk callout and for ES deprecation type row/flyout behaviors (default, index settings, cluster settings, and ML snapshots).

## Test plan

- [x] node scripts/check_changes.ts
- [x] yarn test:jest x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations
- [x] yarn test:type_check --project x-pack/platform/plugins/private/upgrade_assistant/tsconfig.json

Made-with: Cursor
## Summary

Adds focused unit tests for indices resolution/action UI logic (recommended actions and action-button visibility), and tightens the existing warning modal unit test to keep it assertion-free.

## Test plan

- [x] node scripts/check_changes.ts
- [x] yarn test:jest x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations
- [x] yarn test:type_check --project x-pack/platform/plugins/private/upgrade_assistant/tsconfig.json

Made-with: Cursor
## Summary

Adds unit tests for data stream migration UI behaviors, including recommended action and action-button visibility, container metadata formatting, confirm steps (reindex/readonly) and checklist/progress states.

## Test plan

- [x] node scripts/check_changes.ts
- [x] yarn test:jest x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations
- [x] yarn test:type_check --project x-pack/platform/plugins/private/upgrade_assistant/tsconfig.json

Made-with: Cursor
## Summary

Removes flaky client integration coverage for ES deprecations now replaced by focused unit tests.

## Test plan

- [x] node scripts/check_changes.ts
- [x] yarn test:jest x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations
- [x] yarn test:type_check --project x-pack/platform/plugins/private/upgrade_assistant/tsconfig.json

Made-with: Cursor
…ests

Tighten ES deprecations unit tests by asserting flyout body details, fixing empty-state totals, reducing selector brittleness, and eliminating shared mocks to prevent cross-test leakage.

Made-with: Cursor
Add missing unit assertions and scenarios to fully cover behaviors previously exercised by the removed client integration suite.

Made-with: Cursor
Prefer partial mocks (merge jest.requireActual) for shared modules like app context, shared imports, and ui metrics to avoid brittle failures when new exports are added.

Made-with: Cursor
@kapral18 kapral18 force-pushed the chore/upgrade-assistant/fix-es-deprecations-flaky-tests-257356 branch from a62a409 to 7912af2 Compare March 24, 2026 20:29
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
upgradeAssistant 227.2KB 227.2KB +33.0B

History

Copy link
Copy Markdown
Contributor

@SoniaSanzV SoniaSanzV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job! LGTM!

@kapral18 kapral18 merged commit bca01c1 into elastic:main Mar 26, 2026
18 checks passed
@kapral18 kapral18 deleted the chore/upgrade-assistant/fix-es-deprecations-flaky-tests-257356 branch March 26, 2026 20:44
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.3

https://github.com/elastic/kibana/actions/runs/23617104937

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
9.3 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.3:
- [Index Management] Migrate flaky integration tests to unit tests (#258942)
- [Dashboards] Fix backups service (#257762)
- [Security Solution] only show notes for a saved timeline (ignoring emtpy string from draft timelines) (#259658)
- [Security Solution][Detection Engine] Fix alert count so max alerts warning shows correctly (#259199)

Manual backport

To create the backport manually run:

node scripts/backport --pr 258142

Questions ?

Please refer to the Backport tool documentation

mbondyra added a commit to mbondyra/kibana that referenced this pull request Mar 26, 2026
…hanges

* commit '22bf09c82658b9511cbb2ad13f6dd29ad3526472': (21 commits)
  [Overlays System Flyout]: Support Child History (elastic#256339)
  KUA-Update event naming format and examples (elastic#259846)
  Fix pagerduty connector codeownership (elastic#259807)
  [Upgrade Assistant] Migrate Kibana deprecations flaky integration tests to unit tests (elastic#258981)
  [Upgrade Assistant] Migrate ES deprecations flaky integration tests to unit tests (elastic#258142)
  [Index Management] Migrate flaky integration tests to unit tests (elastic#258942)
  [Cases] Rename attachment id to saved object id (elastic#259158)
  [Entity Store] Change hash algo to sha256 (elastic#259453)
  [Security Solution] fixed enhanced security profile header showing for non-alert documents (elastic#259801)
  Update LaunchDarkly (main) (elastic#259008)
  [Discover] Add observability default ES|QL query (elastic#257268)
  Update dependency @redocly/cli to v2.21.1 (main) (elastic#259016)
  Gap reason detected (elastic#258231)
  [One Workflow] Historical executionContext and telemetry (elastic#258623)
  coderabbit: drop SigEvents (elastic#259863)
  [ci] Bump cypress disk (elastic#259861)
  Server timings (elastic#258915)
  Replace deprecated EUI icons in files owned by @elastic/kibana-cases (elastic#255633)
  [ci] Bump storybooks disk (elastic#259858)
  [drilldowns] require embeddables to opt into ON_OPEN_PANEL_MENU trigger (elastic#259637)
  ...
kapral18 added a commit to kapral18/kibana that referenced this pull request Mar 27, 2026
…o unit tests (elastic#258142)

- Migrates ES deprecations coverage from flaky client integration tests
to focused unit tests.
- Adds unit coverage for the ES deprecations page/table (refresh,
counts, filters/search, pagination) and key deprecation types (default,
index settings, cluster settings, ML snapshots, indices reindex/readonly
actions, data streams migration).
- Removes the legacy `__jest__/client_integration/es_deprecations` specs
and harness.

- Closes elastic#241740
- Closes elastic#248431
- Closes elastic#248433
- Closes elastic#257356

- [Integration → unit test mapping
(gist)](https://gist.github.com/kapral18/223345de2e7b80156a8d82c94ca05098)

- [x] `node scripts/check_changes.ts`
- [x] `yarn test:jest
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations`
- [x] `yarn test:type_check --project
x-pack/platform/plugins/private/upgrade_assistant/tsconfig.json`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **Tests**
* Reorganized test infrastructure for Elasticsearch deprecations module,
consolidating mock data into centralized fixtures and refactoring
integration tests into focused unit tests for individual components and
scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

(cherry picked from commit bca01c1)
@kapral18
Copy link
Copy Markdown
Contributor Author

💚 All backports created successfully

Status Branch Result
9.3

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

Questions ?

Please refer to the Backport tool documentation

kapral18 added a commit to kapral18/kibana that referenced this pull request Mar 30, 2026
…o unit tests (elastic#258142)

- Migrates ES deprecations coverage from flaky client integration tests
to focused unit tests.
- Adds unit coverage for the ES deprecations page/table (refresh,
counts, filters/search, pagination) and key deprecation types (default,
index settings, cluster settings, ML snapshots, indices reindex/readonly
actions, data streams migration).
- Removes the legacy `__jest__/client_integration/es_deprecations` specs
and harness.

- Closes elastic#241740
- Closes elastic#248431
- Closes elastic#248433
- Closes elastic#257356

- [Integration → unit test mapping
(gist)](https://gist.github.com/kapral18/223345de2e7b80156a8d82c94ca05098)

- [x] `node scripts/check_changes.ts`
- [x] `yarn test:jest
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations`
- [x] `yarn test:type_check --project
x-pack/platform/plugins/private/upgrade_assistant/tsconfig.json`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **Tests**
* Reorganized test infrastructure for Elasticsearch deprecations module,
consolidating mock data into centralized fixtures and refactoring
integration tests into focused unit tests for individual components and
scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

(cherry picked from commit bca01c1)
kapral18 added a commit to kapral18/kibana that referenced this pull request Mar 30, 2026
…o unit tests (elastic#258142)

- Migrates ES deprecations coverage from flaky client integration tests
to focused unit tests.
- Adds unit coverage for the ES deprecations page/table (refresh,
counts, filters/search, pagination) and key deprecation types (default,
index settings, cluster settings, ML snapshots, indices reindex/readonly
actions, data streams migration).
- Removes the legacy `__jest__/client_integration/es_deprecations` specs
and harness.

- Closes elastic#241740
- Closes elastic#248431
- Closes elastic#248433
- Closes elastic#257356

- [Integration → unit test mapping
(gist)](https://gist.github.com/kapral18/223345de2e7b80156a8d82c94ca05098)

- [x] `node scripts/check_changes.ts`
- [x] `yarn test:jest
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations`
- [x] `yarn test:type_check --project
x-pack/platform/plugins/private/upgrade_assistant/tsconfig.json`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **Tests**
* Reorganized test infrastructure for Elasticsearch deprecations module,
consolidating mock data into centralized fixtures and refactoring
integration tests into focused unit tests for individual components and
scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

(cherry picked from commit bca01c1)
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 30, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.
cc: @kapral18

kapral18 added a commit that referenced this pull request Mar 31, 2026
…ests to unit tests (#258142) (#260111)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[Upgrade Assistant] Migrate ES deprecations flaky integration tests
to unit tests (#258142)](#258142)

<!--- 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-26T20:43:57Z","message":"[Upgrade
Assistant] Migrate ES deprecations flaky integration tests to unit tests
(#258142)\n\n## Summary\n- Migrates ES deprecations coverage from flaky
client integration tests\nto focused unit tests.\n- Adds unit coverage
for the ES deprecations page/table (refresh,\ncounts, filters/search,
pagination) and key deprecation types (default,\nindex settings, cluster
settings, ML snapshots, indices reindex/readonly\nactions, data streams
migration).\n- Removes the legacy
`__jest__/client_integration/es_deprecations` specs\nand harness.\n\n##
Closes\n- Closes #241740\n- Closes #248431\n- Closes #248433\n- Closes
#257356\n\n## Coverage mapping\n- [Integration → unit test
mapping\n(gist)](https://gist.github.com/kapral18/223345de2e7b80156a8d82c94ca05098)\n\n##
Test plan\n- [x] `node scripts/check_changes.ts`\n- [x] `yarn
test:jest\nx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations`\n-
[x] `yarn test:type_check
--project\nx-pack/platform/plugins/private/upgrade_assistant/tsconfig.json`\n\n\n##
Summary by CodeRabbit\n\n* **Tests**\n* Reorganized test infrastructure
for Elasticsearch deprecations module,\nconsolidating mock data into
centralized fixtures and refactoring\nintegration tests into focused
unit tests for individual components
and\nscenarios.\n","sha":"bca01c1d3054e43bffa02e4155aafda2daf17f60","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Kibana
Management","release_note:skip","Feature:Upgrade
Assistant","backport:version","v9.4.0","v9.3.3"],"title":"[Upgrade
Assistant] Migrate ES deprecations flaky integration tests to unit
tests","number":258142,"url":"https://github.com/elastic/kibana/pull/258142","mergeCommit":{"message":"[Upgrade
Assistant] Migrate ES deprecations flaky integration tests to unit tests
(#258142)\n\n## Summary\n- Migrates ES deprecations coverage from flaky
client integration tests\nto focused unit tests.\n- Adds unit coverage
for the ES deprecations page/table (refresh,\ncounts, filters/search,
pagination) and key deprecation types (default,\nindex settings, cluster
settings, ML snapshots, indices reindex/readonly\nactions, data streams
migration).\n- Removes the legacy
`__jest__/client_integration/es_deprecations` specs\nand harness.\n\n##
Closes\n- Closes #241740\n- Closes #248431\n- Closes #248433\n- Closes
#257356\n\n## Coverage mapping\n- [Integration → unit test
mapping\n(gist)](https://gist.github.com/kapral18/223345de2e7b80156a8d82c94ca05098)\n\n##
Test plan\n- [x] `node scripts/check_changes.ts`\n- [x] `yarn
test:jest\nx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations`\n-
[x] `yarn test:type_check
--project\nx-pack/platform/plugins/private/upgrade_assistant/tsconfig.json`\n\n\n##
Summary by CodeRabbit\n\n* **Tests**\n* Reorganized test infrastructure
for Elasticsearch deprecations module,\nconsolidating mock data into
centralized fixtures and refactoring\nintegration tests into focused
unit tests for individual components
and\nscenarios.\n","sha":"bca01c1d3054e43bffa02e4155aafda2daf17f60"}},"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/258142","number":258142,"mergeCommit":{"message":"[Upgrade
Assistant] Migrate ES deprecations flaky integration tests to unit tests
(#258142)\n\n## Summary\n- Migrates ES deprecations coverage from flaky
client integration tests\nto focused unit tests.\n- Adds unit coverage
for the ES deprecations page/table (refresh,\ncounts, filters/search,
pagination) and key deprecation types (default,\nindex settings, cluster
settings, ML snapshots, indices reindex/readonly\nactions, data streams
migration).\n- Removes the legacy
`__jest__/client_integration/es_deprecations` specs\nand harness.\n\n##
Closes\n- Closes #241740\n- Closes #248431\n- Closes #248433\n- Closes
#257356\n\n## Coverage mapping\n- [Integration → unit test
mapping\n(gist)](https://gist.github.com/kapral18/223345de2e7b80156a8d82c94ca05098)\n\n##
Test plan\n- [x] `node scripts/check_changes.ts`\n- [x] `yarn
test:jest\nx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations`\n-
[x] `yarn test:type_check
--project\nx-pack/platform/plugins/private/upgrade_assistant/tsconfig.json`\n\n\n##
Summary by CodeRabbit\n\n* **Tests**\n* Reorganized test infrastructure
for Elasticsearch deprecations module,\nconsolidating mock data into
centralized fixtures and refactoring\nintegration tests into focused
unit tests for individual components
and\nscenarios.\n","sha":"bca01c1d3054e43bffa02e4155aafda2daf17f60"}},{"branch":"9.3","label":"v9.3.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: Claude <noreply@anthropic.com>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 31, 2026
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Apr 1, 2026
…o unit tests (elastic#258142)

## Summary
- Migrates ES deprecations coverage from flaky client integration tests
to focused unit tests.
- Adds unit coverage for the ES deprecations page/table (refresh,
counts, filters/search, pagination) and key deprecation types (default,
index settings, cluster settings, ML snapshots, indices reindex/readonly
actions, data streams migration).
- Removes the legacy `__jest__/client_integration/es_deprecations` specs
and harness.

## Closes
- Closes elastic#241740
- Closes elastic#248431
- Closes elastic#248433
- Closes elastic#257356

## Coverage mapping
- [Integration → unit test mapping
(gist)](https://gist.github.com/kapral18/223345de2e7b80156a8d82c94ca05098)

## Test plan
- [x] `node scripts/check_changes.ts`
- [x] `yarn test:jest
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations`
- [x] `yarn test:type_check --project
x-pack/platform/plugins/private/upgrade_assistant/tsconfig.json`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Tests**
* Reorganized test infrastructure for Elasticsearch deprecations module,
consolidating mock data into centralized fixtures and refactoring
integration tests into focused unit tests for individual components and
scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
…o unit tests (elastic#258142)

## Summary
- Migrates ES deprecations coverage from flaky client integration tests
to focused unit tests.
- Adds unit coverage for the ES deprecations page/table (refresh,
counts, filters/search, pagination) and key deprecation types (default,
index settings, cluster settings, ML snapshots, indices reindex/readonly
actions, data streams migration).
- Removes the legacy `__jest__/client_integration/es_deprecations` specs
and harness.

## Closes
- Closes elastic#241740
- Closes elastic#248431
- Closes elastic#248433
- Closes elastic#257356

## Coverage mapping
- [Integration → unit test mapping
(gist)](https://gist.github.com/kapral18/223345de2e7b80156a8d82c94ca05098)

## Test plan
- [x] `node scripts/check_changes.ts`
- [x] `yarn test:jest
x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations`
- [x] `yarn test:type_check --project
x-pack/platform/plugins/private/upgrade_assistant/tsconfig.json`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Tests**
* Reorganized test infrastructure for Elasticsearch deprecations module,
consolidating mock data into centralized fixtures and refactoring
integration tests into focused unit tests for individual components and
scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment