[Upgrade Assistant] Migrate ES deprecations flaky integration tests to unit tests#258142
Conversation
b43430c to
9f864dd
Compare
|
@coderabbitai review full |
|
🧠 Learnings used✅ Actions performedFull review triggered. |
|
🧠 Learnings used✅ Actions performedFull review triggered. |
|
🧠 Learnings used✅ Actions performedFull review triggered. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughThe 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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Comment |
There was a problem hiding this comment.
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 | 🟠 MajorReset shared
basePropsmocks per test to avoid false positives.
baseProps.confirmandbaseProps.closeModalare shared across test cases. Without resetting, prior calls can make latertoHaveBeenCalled()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:createEsDeprecationsshould 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
removeContentis 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
📒 Files selected for processing (32)
x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/cluster_settings_deprecation_flyout.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/data_streams_deprecation.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/default_deprecation_flyout.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/deprecations_list.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/error_handling.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/es_deprecations.helpers.tsxx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/index_settings_deprecation_flyout.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/ml_snapshots_deprecation_flyout.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/mocked_responses.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/readonly_index_modal.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/reindex_deprecation_flyout.test.tsx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/es_deprecations.tsx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/common/nodes_low_disk_space.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/cluster_settings/flyout.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/cluster_settings/table_row.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/actions_table_cell.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/container.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/checklist_reindex_step.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/progress.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/readonly_confirm_step.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/reindex_confirm_step.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/resolution_table_cell.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/flyout.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/table_row.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/flyout.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/table_row.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/actions_table_cell.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_modal.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/resolution_table_cell.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/flyout.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.test.tsxx-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
...ic/application/components/es_deprecations/deprecation_types/cluster_settings/flyout.test.tsx
Show resolved
Hide resolved
...ate/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.test.tsx
Show resolved
Hide resolved
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughRemoves 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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
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 | 🟠 MajorCreate fresh props per test instead of reusing shared mocks.
baseProps.confirmandbaseProps.closeModalare singletonjest.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 againstprops.confirm/props.closeModalwithtoHaveBeenCalledTimes(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_FORMATandFILE_SIZE_DISPLAY_FORMATduplicated 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, andcreateIndexContextare duplicated here and indeprecation_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 stabledata-test-subjunder 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.migrationsDeprecationshere so new base fixtures likemockClusterSettingDeprecationare 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
📒 Files selected for processing (32)
x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/cluster_settings_deprecation_flyout.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/data_streams_deprecation.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/default_deprecation_flyout.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/deprecations_list.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/error_handling.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/es_deprecations.helpers.tsxx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/index_settings_deprecation_flyout.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/ml_snapshots_deprecation_flyout.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/mocked_responses.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/readonly_index_modal.test.tsx-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/reindex_deprecation_flyout.test.tsx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/es_deprecations.tsx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/common/nodes_low_disk_space.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/cluster_settings/flyout.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/cluster_settings/table_row.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/actions_table_cell.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/container.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/checklist_reindex_step.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/progress.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/readonly_confirm_step.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/reindex_confirm_step.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/resolution_table_cell.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/flyout.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/table_row.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/flyout.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/table_row.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/actions_table_cell.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_modal.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/resolution_table_cell.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/flyout.test.tsxx-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.test.tsxx-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
d6e1b3a to
ab7ae67
Compare
|
Pinging @elastic/kibana-management (Team:Kibana Management) |
b6fb605 to
bfdd96d
Compare
9126586 to
a62a409
Compare
## 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
Made-with: Cursor
a62a409 to
7912af2
Compare
💚 Build Succeeded
Metrics [docs]Async chunks
History
|
|
Starting backport for target branches: 9.3 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
…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) ...
…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)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…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)
…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)
|
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. |
…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>
…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 -->
…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 -->
Summary
__jest__/client_integration/es_deprecationsspecs and harness.Closes
Coverage mapping
Test plan
node scripts/check_changes.tsyarn test:jest x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecationsyarn test:type_check --project x-pack/platform/plugins/private/upgrade_assistant/tsconfig.jsonSummary by CodeRabbit