diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cold_phase.test.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cold_phase.test.ts index 30b229834deddd1..b2c0e1a46c355c2 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cold_phase.test.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cold_phase.test.ts @@ -46,166 +46,181 @@ describe(' node allocation in the cold phase', () => { component.update(); }); - test('shows spinner for node attributes input when loading', async () => { - server.respondImmediately = false; - - const { actions, component } = testBed; - await actions.enable(true); - - expect(component.find('.euiLoadingSpinner').exists()).toBeTruthy(); - expect(actions.hasDataTierAllocationControls()).toBeTruthy(); - - expect(component.find('.euiCallOut--warning').exists()).toBeFalsy(); - expect(actions.hasNodeAttributesSelect()).toBeFalsy(); - }); - - test('offers DATA TIER allocation guidance when no attributes exist and data tiers are available', async () => { + test(`doesn't offer allocation guidance when node with deprecated "data" role exists`, async () => { httpRequestsMockHelpers.setListNodes({ nodesByAttributes: {}, - nodesByRoles: { data: ['node1'] }, + nodesByRoles: { data: ['test'] }, isUsingDeprecatedDataRoleConfig: false, }); - await setup(); const { actions, component } = testBed; component.update(); await actions.enable(true); - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - await actions.setDataAllocation('node_attrs'); - expect(actions.hasDefaultToDataTiersNotice()).toBeTruthy(); - expect(actions.hasNodeAttributesSelect()).toBeFalsy(); + expect(actions.isAllocationLoading()).toBeFalsy(); + expect(actions.hasWillUseFallbackTierNotice()).toBeFalsy(); }); - test('offers DATA TIER FALLBACK allocation guidance when no attributes exist and data tiers are available, but not for the cold phase', async () => { - httpRequestsMockHelpers.setListNodes({ - nodesByAttributes: {}, - nodesByRoles: { data_warm: ['node1'] }, - isUsingDeprecatedDataRoleConfig: false, - }); + describe('when using node attributes', () => { + test('shows spinner for node attributes input when loading', async () => { + server.respondImmediately = false; - await setup(); - const { actions, component } = testBed; - - component.update(); - await actions.enable(true); + const { actions } = testBed; + await actions.enable(true); - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - await actions.setDataAllocation('node_attrs'); - expect(actions.hasWillUseFallbackTierNotice()).toBeTruthy(); - expect(actions.hasNodeAttributesSelect()).toBeFalsy(); - }); + expect(actions.isAllocationLoading()).toBeTruthy(); + expect(actions.hasDataTierAllocationControls()).toBeTruthy(); + expect(actions.hasNodeAttributesSelect()).toBeFalsy(); - test('offers DATA NODE allocation guidance when no attributes exist and data nodes are in use', async () => { - httpRequestsMockHelpers.setListNodes({ - nodesByAttributes: {}, - nodesByRoles: {}, - isUsingDeprecatedDataRoleConfig: true, + // No notices will be shown. + expect(actions.hasDefaultToDataTiersNotice()).toBeFalsy(); + expect(actions.hasWillUseFallbackTierUsingNodeAttributesNotice()).toBeFalsy(); + expect(actions.hasDefaultToDataNodesNotice()).toBeFalsy(); + expect(actions.hasNoTiersAvailableUsingNodeAttributesNotice()).toBeFalsy(); }); - await setup(); - const { actions, component } = testBed; - - component.update(); - await actions.enable(true); + describe('and some are defined', () => { + test('shows the node attributes input', async () => { + const { actions } = testBed; + await actions.enable(true); - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - await actions.setDataAllocation('node_attrs'); - expect(actions.hasDefaultToDataNodesNotice()).toBeTruthy(); - expect(actions.hasNodeAttributesSelect()).toBeFalsy(); - }); + expect(actions.isAllocationLoading()).toBeFalsy(); + await actions.setDataAllocation('node_attrs'); + expect(actions.hasDefaultAllocationBehaviorNotice()).toBeFalsy(); + expect(actions.hasNodeAttributesSelect()).toBeTruthy(); + expect(actions.getNodeAttributesSelectOptions().length).toBe(2); + }); - test('shows node attributes input when attributes exist', async () => { - const { actions, component } = testBed; - await actions.enable(true); + test('shows view node attributes link when an attribute is selected and shows flyout when clicked', async () => { + const { actions } = testBed; - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - await actions.setDataAllocation('node_attrs'); - expect(actions.hasDefaultAllocationBehaviorNotice()).toBeFalsy(); - expect(actions.hasNodeAttributesSelect()).toBeTruthy(); - expect(actions.getNodeAttributesSelectOptions().length).toBe(2); - }); + await actions.enable(true); - test('shows view node attributes link when an attribute is selected and shows flyout when clicked', async () => { - const { actions, component } = testBed; + expect(actions.isAllocationLoading()).toBeFalsy(); + await actions.setDataAllocation('node_attrs'); + expect(actions.hasDefaultAllocationBehaviorNotice()).toBeFalsy(); + expect(actions.hasNodeAttributesSelect()).toBeTruthy(); - await actions.enable(true); + expect(actions.hasNodeDetailsFlyout()).toBeFalsy(); + expect(actions.getNodeAttributesSelectOptions().length).toBe(2); + await actions.setSelectedNodeAttribute('attribute:true'); - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - await actions.setDataAllocation('node_attrs'); - expect(actions.hasDefaultAllocationBehaviorNotice()).toBeFalsy(); - expect(actions.hasNodeAttributesSelect()).toBeTruthy(); + await actions.openNodeDetailsFlyout(); + expect(actions.hasNodeDetailsFlyout()).toBeTruthy(); + }); + }); - expect(actions.hasNodeDetailsFlyout()).toBeFalsy(); - expect(actions.getNodeAttributesSelectOptions().length).toBe(2); - await actions.setSelectedNodeAttribute('attribute:true'); + describe('and none are defined', () => { + const commonSetupAndBaselineAssertions = async () => { + await setup(); + const { actions, component } = testBed; + component.update(); + await actions.enable(true); + + expect(actions.isAllocationLoading()).toBeFalsy(); + await actions.setDataAllocation('node_attrs'); + expect(actions.hasNodeAttributesSelect()).toBeFalsy(); + }; + + test('and data tiers are available, shows DefaultToDataTiersNotice', async () => { + httpRequestsMockHelpers.setListNodes({ + nodesByAttributes: {}, + nodesByRoles: { data: ['node1'] }, + isUsingDeprecatedDataRoleConfig: false, + }); + + await commonSetupAndBaselineAssertions(); + const { actions } = testBed; + expect(actions.hasDefaultToDataTiersNotice()).toBeTruthy(); + }); - await actions.openNodeDetailsFlyout(); - expect(actions.hasNodeDetailsFlyout()).toBeTruthy(); - }); + test('and data tiers are available, but not for the cold phase, shows WillUseFallbackTierUsingNodeAttributesNotice', async () => { + httpRequestsMockHelpers.setListNodes({ + nodesByAttributes: {}, + nodesByRoles: { data_warm: ['node1'] }, + isUsingDeprecatedDataRoleConfig: false, + }); - test('offers allocation guidance when no node roles are found', async () => { - httpRequestsMockHelpers.setListNodes({ - nodesByAttributes: {}, - nodesByRoles: {}, - isUsingDeprecatedDataRoleConfig: false, - }); + await commonSetupAndBaselineAssertions(); + const { actions } = testBed; + expect(actions.hasWillUseFallbackTierUsingNodeAttributesNotice()).toBeTruthy(); + }); - await setup(); - const { actions, component } = testBed; + test('when data nodes are in use, shows DefaultToDataNodesNotice', async () => { + httpRequestsMockHelpers.setListNodes({ + nodesByAttributes: {}, + nodesByRoles: {}, + isUsingDeprecatedDataRoleConfig: true, + }); - component.update(); - await actions.enable(true); + await commonSetupAndBaselineAssertions(); + const { actions } = testBed; + expect(actions.hasDefaultToDataNodesNotice()).toBeTruthy(); + }); - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - expect(actions.hasNoTiersAvailableNotice()).toBeTruthy(); + test('when no data tier node roles are defined, shows NoTiersAvailableUsingNodeAttributesNotice', async () => { + httpRequestsMockHelpers.setListNodes({ + nodesByAttributes: {}, + // data_content is a node role so they're technically in use, but it's not a data tier node role. + nodesByRoles: { data_content: ['node1'] }, + isUsingDeprecatedDataRoleConfig: false, + }); + + await commonSetupAndBaselineAssertions(); + const { actions } = testBed; + expect(actions.hasNoTiersAvailableUsingNodeAttributesNotice()).toBeTruthy(); + }); + }); }); - [ - { - nodesByRoles: { data_hot: ['test'] }, - fallbackTier: 'hot', - }, - { - nodesByRoles: { data_hot: ['test'], data_warm: ['test'] }, - fallbackTier: 'warm', - }, - ].forEach(({ nodesByRoles, fallbackTier }) => { - test(`in the cold phase, offers allocation guidance when allocation will fallback to the ${fallbackTier} tier`, async () => { + describe('when using node roles', () => { + test('when no node roles are defined, shows NoTiersAvailableNotice', async () => { httpRequestsMockHelpers.setListNodes({ nodesByAttributes: {}, - nodesByRoles, + nodesByRoles: {}, isUsingDeprecatedDataRoleConfig: false, }); await setup(); - const { actions, component, find } = testBed; + const { actions, component } = testBed; component.update(); await actions.enable(true); - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - expect(actions.hasWillUseFallbackTierNotice()).toBeTruthy(); - expect(find('willUseFallbackTierNotice').text()).toContain( - `No nodes assigned to the cold tierIf no cold nodes are available, data is stored in the ${fallbackTier} tier.` - ); + expect(actions.isAllocationLoading()).toBeFalsy(); + expect(actions.hasNoTiersAvailableNotice()).toBeTruthy(); }); - }); - test(`doesn't offer allocation guidance when node with "data" role exists`, async () => { - httpRequestsMockHelpers.setListNodes({ - nodesByAttributes: {}, - nodesByRoles: { data: ['test'] }, - isUsingDeprecatedDataRoleConfig: false, + [ + { + nodesByRoles: { data_hot: ['test'] }, + fallbackTier: 'hot', + }, + { + nodesByRoles: { data_hot: ['test'], data_warm: ['test'] }, + fallbackTier: 'warm', + }, + ].forEach(({ nodesByRoles, fallbackTier }) => { + test(`when allocation will fallback to the ${fallbackTier} tier, shows WillUseFallbackTierNotice and defines the fallback tier`, async () => { + httpRequestsMockHelpers.setListNodes({ + nodesByAttributes: {}, + nodesByRoles, + isUsingDeprecatedDataRoleConfig: false, + }); + + await setup(); + const { actions, component, find } = testBed; + + component.update(); + await actions.enable(true); + + expect(actions.isAllocationLoading()).toBeFalsy(); + expect(actions.hasWillUseFallbackTierNotice()).toBeTruthy(); + expect(actions.getWillUseFallbackTierNoticeText()).toContain( + `No nodes assigned to the cold tierIf no cold nodes are available, data is stored in the ${fallbackTier} tier.` + ); + }); }); - await setup(); - const { actions, component } = testBed; - - component.update(); - await actions.enable(true); - - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - expect(actions.hasWillUseFallbackTierNotice()).toBeFalsy(); }); }); diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/warm_phase.test.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/warm_phase.test.ts index a8ab57c21df61e6..0ab18c6e05736cf 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/warm_phase.test.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/warm_phase.test.ts @@ -46,151 +46,169 @@ describe(' node allocation in the warm phase', () => { component.update(); }); - test('shows spinner for node attributes input when loading', async () => { - server.respondImmediately = false; - - const { actions, component } = testBed; - await actions.enable(true); - - expect(component.find('.euiLoadingSpinner').exists()).toBeTruthy(); - expect(actions.hasDataTierAllocationControls()).toBeTruthy(); - - expect(component.find('.euiCallOut--warning').exists()).toBeFalsy(); - expect(actions.hasNodeAttributesSelect()).toBeFalsy(); - }); - - test('offers DATA TIER allocation guidance when no attributes exist and data tiers are available', async () => { + test(`doesn't offer allocation guidance when node with deprecated "data" role exists`, async () => { httpRequestsMockHelpers.setListNodes({ nodesByAttributes: {}, - nodesByRoles: { data: ['node1'] }, + nodesByRoles: { data: ['test'] }, isUsingDeprecatedDataRoleConfig: false, }); - await setup(); const { actions, component } = testBed; component.update(); await actions.enable(true); - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - await actions.setDataAllocation('node_attrs'); - expect(actions.hasDefaultToDataTiersNotice()).toBeTruthy(); - expect(actions.hasNodeAttributesSelect()).toBeFalsy(); + expect(actions.isAllocationLoading()).toBeFalsy(); + expect(actions.hasDefaultAllocationBehaviorNotice()).toBeFalsy(); }); - test('offers DATA TIER FALLBACK allocation guidance when no attributes exist and data tiers are available, but not for the warm phase', async () => { - httpRequestsMockHelpers.setListNodes({ - nodesByAttributes: {}, - nodesByRoles: { data_hot: ['node1'] }, - isUsingDeprecatedDataRoleConfig: false, - }); + describe('when using node attributes', () => { + test('shows spinner for node attributes input when loading', async () => { + server.respondImmediately = false; - await setup(); - const { actions, component } = testBed; + const { actions } = testBed; + await actions.enable(true); - component.update(); - await actions.enable(true); + expect(actions.isAllocationLoading()).toBeTruthy(); + expect(actions.hasDataTierAllocationControls()).toBeTruthy(); + expect(actions.hasNodeAttributesSelect()).toBeFalsy(); - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - await actions.setDataAllocation('node_attrs'); - expect(actions.hasWillUseFallbackTierNotice()).toBeTruthy(); - expect(actions.hasNodeAttributesSelect()).toBeFalsy(); - }); - - test('offers DATA NODE allocation guidance when no attributes exist and data nodes are in use', async () => { - httpRequestsMockHelpers.setListNodes({ - nodesByAttributes: {}, - nodesByRoles: {}, - isUsingDeprecatedDataRoleConfig: true, + // No notices will be shown. + expect(actions.hasDefaultToDataTiersNotice()).toBeFalsy(); + expect(actions.hasWillUseFallbackTierUsingNodeAttributesNotice()).toBeFalsy(); + expect(actions.hasDefaultToDataNodesNotice()).toBeFalsy(); + expect(actions.hasNoTiersAvailableUsingNodeAttributesNotice()).toBeFalsy(); }); - await setup(); - const { actions, component } = testBed; - - component.update(); - await actions.enable(true); - - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - await actions.setDataAllocation('node_attrs'); - expect(actions.hasDefaultToDataNodesNotice()).toBeTruthy(); - expect(actions.hasNodeAttributesSelect()).toBeFalsy(); - }); - - test('shows node attributes input when attributes exist', async () => { - const { actions, component } = testBed; - await actions.enable(true); - - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - await actions.setDataAllocation('node_attrs'); - expect(actions.hasDefaultAllocationBehaviorNotice()).toBeFalsy(); - expect(actions.hasNodeAttributesSelect()).toBeTruthy(); - expect(actions.getNodeAttributesSelectOptions().length).toBe(2); - }); - - test('shows view node attributes link when an attribute is selected and shows flyout when clicked', async () => { - const { actions, component } = testBed; - await actions.enable(true); - - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - await actions.setDataAllocation('node_attrs'); - expect(actions.hasDefaultAllocationBehaviorNotice()).toBeFalsy(); - expect(actions.hasNodeAttributesSelect()).toBeTruthy(); - - expect(actions.hasNodeDetailsFlyout()).toBeFalsy(); - expect(actions.getNodeAttributesSelectOptions().length).toBe(2); - await actions.setSelectedNodeAttribute('attribute:true'); - - await actions.openNodeDetailsFlyout(); - expect(actions.hasNodeDetailsFlyout()).toBeTruthy(); - }); + describe('and some are defined', () => { + test('shows the node attributes input', async () => { + const { actions } = testBed; + await actions.enable(true); + + expect(actions.isAllocationLoading()).toBeFalsy(); + await actions.setDataAllocation('node_attrs'); + expect(actions.hasDefaultAllocationBehaviorNotice()).toBeFalsy(); + expect(actions.hasNodeAttributesSelect()).toBeTruthy(); + expect(actions.getNodeAttributesSelectOptions().length).toBe(2); + }); + + test('shows view node attributes link when an attribute is selected and shows flyout when clicked', async () => { + const { actions } = testBed; + await actions.enable(true); + + expect(actions.isAllocationLoading()).toBeFalsy(); + await actions.setDataAllocation('node_attrs'); + expect(actions.hasDefaultAllocationBehaviorNotice()).toBeFalsy(); + expect(actions.hasNodeAttributesSelect()).toBeTruthy(); + + expect(actions.hasNodeDetailsFlyout()).toBeFalsy(); + expect(actions.getNodeAttributesSelectOptions().length).toBe(2); + await actions.setSelectedNodeAttribute('attribute:true'); + + await actions.openNodeDetailsFlyout(); + expect(actions.hasNodeDetailsFlyout()).toBeTruthy(); + }); + }); - test('offers allocation guidance when no node roles are found', async () => { - httpRequestsMockHelpers.setListNodes({ - nodesByAttributes: {}, - nodesByRoles: {}, - isUsingDeprecatedDataRoleConfig: false, + describe('and none are defined', () => { + const commonSetupAndBaselineAssertions = async () => { + await setup(); + const { actions, component } = testBed; + component.update(); + await actions.enable(true); + + expect(actions.isAllocationLoading()).toBeFalsy(); + await actions.setDataAllocation('node_attrs'); + expect(actions.hasNodeAttributesSelect()).toBeFalsy(); + }; + + test('and data tiers are available, shows DefaultToDataTiersNotice', async () => { + httpRequestsMockHelpers.setListNodes({ + nodesByAttributes: {}, + nodesByRoles: { data: ['node1'] }, + isUsingDeprecatedDataRoleConfig: false, + }); + + await commonSetupAndBaselineAssertions(); + const { actions } = testBed; + expect(actions.hasDefaultToDataTiersNotice()).toBeTruthy(); + }); + + test('and data tiers are available, but not for the warm phase, shows WillUseFallbackTierUsingNodeAttributesNotice', async () => { + httpRequestsMockHelpers.setListNodes({ + nodesByAttributes: {}, + nodesByRoles: { data_hot: ['node1'] }, + isUsingDeprecatedDataRoleConfig: false, + }); + + await commonSetupAndBaselineAssertions(); + const { actions } = testBed; + expect(actions.hasWillUseFallbackTierUsingNodeAttributesNotice()).toBeTruthy(); + }); + + test('when data nodes are in use, shows DefaultToDataNodesNotice', async () => { + httpRequestsMockHelpers.setListNodes({ + nodesByAttributes: {}, + nodesByRoles: {}, + isUsingDeprecatedDataRoleConfig: true, + }); + + await commonSetupAndBaselineAssertions(); + const { actions } = testBed; + expect(actions.hasDefaultToDataNodesNotice()).toBeTruthy(); + }); + + test('when no data tier node roles are defined, shows NoTiersAvailableUsingNodeAttributesNotice', async () => { + httpRequestsMockHelpers.setListNodes({ + nodesByAttributes: {}, + // data_content is a node role so they're technically in use, but it's not a data tier node role. + nodesByRoles: { data_content: ['node1'] }, + isUsingDeprecatedDataRoleConfig: false, + }); + + await commonSetupAndBaselineAssertions(); + const { actions } = testBed; + expect(actions.hasNoTiersAvailableUsingNodeAttributesNotice()).toBeTruthy(); + }); }); + }); - await setup(); - const { actions, component } = testBed; + describe('when using node roles', () => { + test('when no node roles are defined, shows NoTiersAvailableNotice', async () => { + httpRequestsMockHelpers.setListNodes({ + nodesByAttributes: {}, + nodesByRoles: {}, + isUsingDeprecatedDataRoleConfig: false, + }); - component.update(); - await actions.enable(true); + await setup(); + const { actions, component } = testBed; - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - expect(actions.hasNoTiersAvailableNotice()).toBeTruthy(); - }); + component.update(); + await actions.enable(true); - test('in the warm phase, offers allocation guidance when allocation will fallback to the hot tier', async () => { - httpRequestsMockHelpers.setListNodes({ - nodesByAttributes: {}, - nodesByRoles: { data_hot: ['test'], data_cold: ['test'] }, - isUsingDeprecatedDataRoleConfig: false, + expect(actions.isAllocationLoading()).toBeFalsy(); + expect(actions.hasNoTiersAvailableNotice()).toBeTruthy(); }); - await setup(); - const { actions, component } = testBed; + test('when allocation will fallback to the hot tier, shows WillUseFallbackTierNotice and defines the fallback tier', async () => { + httpRequestsMockHelpers.setListNodes({ + nodesByAttributes: {}, + nodesByRoles: { data_hot: ['test'], data_cold: ['test'] }, + isUsingDeprecatedDataRoleConfig: false, + }); - component.update(); - await actions.enable(true); + await setup(); + const { actions, component } = testBed; - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - expect(actions.hasWillUseFallbackTierNotice()).toBeTruthy(); - }); + component.update(); + await actions.enable(true); - test(`doesn't offer allocation guidance when node with "data" role exists`, async () => { - httpRequestsMockHelpers.setListNodes({ - nodesByAttributes: {}, - nodesByRoles: { data: ['test'] }, - isUsingDeprecatedDataRoleConfig: false, + expect(actions.isAllocationLoading()).toBeFalsy(); + expect(actions.hasWillUseFallbackTierNotice()).toBeTruthy(); + expect(actions.getWillUseFallbackTierNoticeText()).toContain( + `No nodes assigned to the warm tierIf no warm nodes are available, data is stored in the hot tier.` + ); }); - await setup(); - const { actions, component } = testBed; - - component.update(); - await actions.enable(true); - - expect(component.find('.euiLoadingSpinner').exists()).toBeFalsy(); - expect(actions.hasDefaultAllocationBehaviorNotice()).toBeFalsy(); }); }); diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/create_node_allocation_actions.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/create_node_allocation_actions.ts index 75fb71ca8938be2..416a2afa54d54da 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/create_node_allocation_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/create_node_allocation_actions.ts @@ -26,12 +26,19 @@ export const createNodeAllocationActions = (testBed: TestBed, phase: Phase) => { component.update(); }; + const isAllocationLoading = () => find(`${phase}-phase.allocationLoadingSpinner`).exists(); const hasDefaultToDataNodesNotice = () => exists(`${phase}-phase.defaultToDataNodesNotice`); const hasDefaultToDataTiersNotice = () => exists(`${phase}-phase.defaultToDataTiersNotice`); const hasDefaultAllocationBehaviorNotice = () => hasDefaultToDataNodesNotice() && hasDefaultToDataTiersNotice(); const hasNoTiersAvailableNotice = () => exists(`${phase}-phase.noTiersAvailableNotice`); + const hasNoTiersAvailableUsingNodeAttributesNotice = () => + exists(`${phase}-phase.noTiersAvailableUsingNodeAttributesNotice`); const hasWillUseFallbackTierNotice = () => exists(`${phase}-phase.willUseFallbackTierNotice`); + const hasWillUseFallbackTierUsingNodeAttributesNotice = () => + exists(`${phase}-phase.willUseFallbackTierUsingNodeAttributesNotice`); + const getWillUseFallbackTierNoticeText = () => + find(`${phase}-phase.willUseFallbackTierNotice`).text(); return { hasDataTierAllocationControls: () => exists(controlsSelector), @@ -56,11 +63,15 @@ export const createNodeAllocationActions = (testBed: TestBed, phase: Phase) => { component.update(); }, setSelectedNodeAttribute: createFormSetValueAction(testBed, nodeAttrsSelector), + isAllocationLoading, hasDefaultToDataNodesNotice, hasDefaultToDataTiersNotice, hasDefaultAllocationBehaviorNotice, hasNoTiersAvailableNotice, + hasNoTiersAvailableUsingNodeAttributesNotice, hasWillUseFallbackTierNotice, + hasWillUseFallbackTierUsingNodeAttributesNotice, + getWillUseFallbackTierNoticeText, hasNodeDetailsFlyout: () => exists(`${phase}-viewNodeDetailsFlyoutButton`), openNodeDetailsFlyout: async () => { await act(async () => { diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/data_tier_allocation_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/data_tier_allocation_field.tsx index 1f69f5622864af7..dbee88a3fea4f0d 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/data_tier_allocation_field.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/data_tier_allocation_field.tsx @@ -194,7 +194,7 @@ export const DataTierAllocationField: FunctionComponent = ({ phase, descr {isLoading ? ( <> - + ) : ( error && (