diff --git a/x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.tsx b/x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.tsx index 9742f2eec525f..55154d5308955 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.tsx @@ -110,6 +110,7 @@ function getFieldsMeta(esDocsBase: string) { { value: STANDARD_INDEX_MODE, inputDisplay: indexModeLabels[STANDARD_INDEX_MODE], + 'data-test-subj': 'index_mode_standard', dropdownDisplay: ( {indexModeLabels[STANDARD_INDEX_MODE]} @@ -122,6 +123,7 @@ function getFieldsMeta(esDocsBase: string) { { value: TIME_SERIES_MODE, inputDisplay: indexModeLabels[TIME_SERIES_MODE], + 'data-test-subj': 'index_mode_time_series', dropdownDisplay: ( {indexModeLabels[TIME_SERIES_MODE]} @@ -134,6 +136,7 @@ function getFieldsMeta(esDocsBase: string) { { value: LOGSDB_INDEX_MODE, inputDisplay: indexModeLabels[LOGSDB_INDEX_MODE], + 'data-test-subj': 'index_mode_logsdb', dropdownDisplay: ( {indexModeLabels[LOGSDB_INDEX_MODE]} diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/template_list/template_details/template_details_content.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/template_list/template_details/template_details_content.tsx index 75446c0c05f2d..5ba051bcaafce 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/template_list/template_details/template_details_content.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/template_list/template_details/template_details_content.tsx @@ -290,6 +290,7 @@ export const TemplateDetailsContent = ({ defaultMessage: 'Edit', }), icon: 'pencil', + 'data-test-subj': 'editIndexTemplateButton', onClick: () => editTemplate(templateName, isLegacy), disabled: isCloudManaged, }, diff --git a/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts b/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts index 0a6101b71ca5c..e91bdeeb5e417 100644 --- a/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts +++ b/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts @@ -17,6 +17,12 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const security = getService('security'); const testSubjects = getService('testSubjects'); + enum INDEX_MODE { + STANDARD = 'Standard', + LOGSDB = 'LogsDB', + TIME_SERIES = 'Time series', + } + const TEST_DS_NAME_1 = 'test-ds-1'; const TEST_DS_NAME_2 = 'test-ds-2'; const TEST_DATA_STREAM_NAMES = [TEST_DS_NAME_1, TEST_DS_NAME_2]; @@ -132,6 +138,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await es.indices.deleteIndexTemplate({ name: `logsdb_index_template`, }); + await testSubjects.click('reloadButton'); }); }); @@ -224,5 +231,171 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); }); }); + + describe('Modify data streams index mode', () => { + const TEST_DS_NAME = 'test-ds'; + const setIndexModeTemplate = async (settings: object) => { + await es.indices.putIndexTemplate({ + name: `index_template_${TEST_DS_NAME}`, + index_patterns: [TEST_DS_NAME], + data_stream: {}, + template: { + settings, + }, + }); + await es.indices.createDataStream({ + name: TEST_DS_NAME, + }); + await testSubjects.click('reloadButton'); + }; + + const verifyIndexModeIsOrigin = async (indexModeName: string) => { + // Open details flyout of data stream + await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME); + // Check that index mode detail exists and its label is origin + expect(await testSubjects.exists('indexModeDetail')).to.be(true); + expect(await testSubjects.getVisibleText('indexModeDetail')).to.be(indexModeName); + // Close flyout + await testSubjects.click('closeDetailsButton'); + // Navigate to the templates tab + await pageObjects.indexManagement.changeTabs('templatesTab'); + await pageObjects.header.waitUntilLoadingHasFinished(); + // Edit template + await pageObjects.indexManagement.clickIndexTemplateNameLink( + `index_template_${TEST_DS_NAME}` + ); + await testSubjects.click('manageTemplateButton'); + await testSubjects.click('editIndexTemplateButton'); + + // Verify index mode is origin + expect(await testSubjects.getVisibleText('indexModeField')).to.be(indexModeName); + }; + + const changeIndexMode = async (indexModeSelector: string) => { + // Modify index mode + await testSubjects.click('indexModeField'); + await testSubjects.click(indexModeSelector); + }; + + const verifyModeHasBeenChanged = async (indexModeName: string) => { + expect(await testSubjects.getVisibleText('indexModeValue')).to.be(indexModeName); + + // Click update template + await pageObjects.indexManagement.clickNextButton(); + + // Verify index mode and close detail tab + expect(await testSubjects.getVisibleText('indexModeValue')).to.be(indexModeName); + await testSubjects.click('closeDetailsButton'); + + // Navigate to the data streams tab + await pageObjects.indexManagement.changeTabs('data_streamsTab'); + await pageObjects.header.waitUntilLoadingHasFinished(); + + // Open data stream + await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME); + // Check that index mode detail exists and its label is destination index mode + expect(await testSubjects.exists('indexModeDetail')).to.be(true); + expect(await testSubjects.getVisibleText('indexModeDetail')).to.be(indexModeName); + // Close flyout + await testSubjects.click('closeDetailsButton'); + }; + + afterEach(async () => { + await log.debug('Cleaning up created data stream'); + + try { + await es.indices.deleteDataStream({ name: TEST_DS_NAME }); + await es.indices.deleteIndexTemplate({ + name: `index_template_${TEST_DS_NAME}`, + }); + } catch (e) { + log.debug('Error deleting test data stream'); + throw e; + } + }); + + it('allows to upgrade data stream from standard to logsdb index mode', async () => { + await setIndexModeTemplate({ + mode: 'standard', + }); + await verifyIndexModeIsOrigin(INDEX_MODE.STANDARD); + + await changeIndexMode('index_mode_logsdb'); + // Navigate to the last step of the wizard + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + + await verifyModeHasBeenChanged(INDEX_MODE.LOGSDB); + }); + + it('allows to downgrade data stream from logsdb to standard index mode', async () => { + await setIndexModeTemplate({ + mode: 'logsdb', + }); + await verifyIndexModeIsOrigin(INDEX_MODE.LOGSDB); + + await changeIndexMode('index_mode_standard'); + // Navigate to the last step of the wizard + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + + await verifyModeHasBeenChanged(INDEX_MODE.STANDARD); + }); + + it('allows to upgrade data stream from time series to logsdb index mode', async () => { + await setIndexModeTemplate({ + mode: 'time_series', + routing_path: 'test', + }); + await verifyIndexModeIsOrigin(INDEX_MODE.TIME_SERIES); + + await changeIndexMode('index_mode_logsdb'); + + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + // Modify Index settings + await testSubjects.setValue('kibanaCodeEditor', '{}', { + clearWithKeyboard: true, + }); + // Navigate to the last step of the wizard + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + + await verifyModeHasBeenChanged(INDEX_MODE.LOGSDB); + }); + + it('allows to downgrade data stream from logsdb to time series index mode', async () => { + await setIndexModeTemplate({ + mode: 'logsdb', + }); + await verifyIndexModeIsOrigin(INDEX_MODE.LOGSDB); + + await changeIndexMode('index_mode_time_series'); + + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + // Modify Index settings + await testSubjects.setValue( + 'kibanaCodeEditor', + JSON.stringify({ index: { mode: 'time_series', routing_path: 'test' } }), + { + clearWithKeyboard: true, + } + ); + // Navigate to the last step of the wizard + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + + await verifyModeHasBeenChanged(INDEX_MODE.TIME_SERIES); + }); + }); }); }; diff --git a/x-pack/test/functional/apps/index_management/index.ts b/x-pack/test/functional/apps/index_management/index.ts index c43f8b9688da5..b75f08565e742 100644 --- a/x-pack/test/functional/apps/index_management/index.ts +++ b/x-pack/test/functional/apps/index_management/index.ts @@ -16,5 +16,6 @@ export default ({ loadTestFile }: FtrProviderContext) => { loadTestFile(require.resolve('./enrich_policies_tab')); loadTestFile(require.resolve('./create_enrich_policy')); loadTestFile(require.resolve('./data_streams_tab')); + loadTestFile(require.resolve('./index_templates_tab')); }); }; diff --git a/x-pack/test/functional/apps/index_management/index_templates_tab/index.ts b/x-pack/test/functional/apps/index_management/index_templates_tab/index.ts index 992c2094c037e..f415bced4a418 100644 --- a/x-pack/test/functional/apps/index_management/index_templates_tab/index.ts +++ b/x-pack/test/functional/apps/index_management/index_templates_tab/index.ts @@ -9,6 +9,6 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default ({ loadTestFile }: FtrProviderContext) => { describe('Index Management: index templates tab', function () { - loadTestFile(require.resolve('./create_index_template')); + loadTestFile(require.resolve('./index_template_tab')); }); }; diff --git a/x-pack/test/functional/apps/index_management/index_templates_tab/create_index_template.ts b/x-pack/test/functional/apps/index_management/index_templates_tab/index_template_tab.ts similarity index 56% rename from x-pack/test/functional/apps/index_management/index_templates_tab/create_index_template.ts rename to x-pack/test/functional/apps/index_management/index_templates_tab/index_template_tab.ts index 68b75fa86a0c5..75f022eaf7555 100644 --- a/x-pack/test/functional/apps/index_management/index_templates_tab/create_index_template.ts +++ b/x-pack/test/functional/apps/index_management/index_templates_tab/index_template_tab.ts @@ -13,21 +13,29 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const log = getService('log'); const security = getService('security'); const testSubjects = getService('testSubjects'); + const es = getService('es'); - const INDEX_TEMPLATE_NAME = `test-index-template`; + const INDEX_TEMPLATE_NAME = `test-index-template-name`; - describe('Create index template', function () { + describe('Index template tab', function () { before(async () => { await log.debug('Navigating to the index templates tab'); await security.testUser.setRoles(['index_management_user']); await pageObjects.common.navigateToApp('indexManagement'); - // Navigate to the data streams tab + // Navigate to the templates tab await pageObjects.indexManagement.changeTabs('templatesTab'); await pageObjects.header.waitUntilLoadingHasFinished(); // Click create template button await testSubjects.click('createTemplateButton'); }); + afterEach(async () => { + await es.indices.deleteIndexTemplate({ + name: INDEX_TEMPLATE_NAME, + }); + await testSubjects.click('reloadButton'); + }); + it('can create an index template with data retention', async () => { // Complete required fields from step 1 await testSubjects.setValue('nameField', INDEX_TEMPLATE_NAME); @@ -46,6 +54,36 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await testSubjects.click('nextButton'); expect(await testSubjects.getVisibleText('lifecycleValue')).to.be('7 hours'); + + // Click Create template + await pageObjects.indexManagement.clickNextButton(); + // Close detail tab + await testSubjects.click('closeDetailsButton'); + }); + + it('can create an index template with logsdb index mode', async () => { + await testSubjects.click('createTemplateButton'); + // Fill out required fields + await testSubjects.setValue('nameField', INDEX_TEMPLATE_NAME); + await testSubjects.setValue('indexPatternsField', 'logsdb-test-index-pattern'); + + await testSubjects.click('indexModeField'); + await testSubjects.click('index_mode_logsdb'); + + // Navigate to the last step of the wizard + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + + expect(await testSubjects.exists('indexModeTitle')).to.be(true); + expect(await testSubjects.getVisibleText('indexModeValue')).to.be('LogsDB'); + + // Click Create template + await pageObjects.indexManagement.clickNextButton(); + // Close detail tab + await testSubjects.click('closeDetailsButton'); }); }); }; diff --git a/x-pack/test/functional/page_objects/index_management_page.ts b/x-pack/test/functional/page_objects/index_management_page.ts index 207bf2281c080..a29e84e677cbc 100644 --- a/x-pack/test/functional/page_objects/index_management_page.ts +++ b/x-pack/test/functional/page_objects/index_management_page.ts @@ -49,6 +49,10 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext) await testSubjects.click('bulkEditDataRetentionButton'); }, + async clickIndexTemplateNameLink(name: string): Promise { + await find.clickByLinkText(name); + }, + async clickDataStreamNameLink(name: string): Promise { await find.clickByLinkText(name); }, diff --git a/x-pack/test_serverless/functional/test_suites/common/management/index_management/data_streams.ts b/x-pack/test_serverless/functional/test_suites/common/management/index_management/data_streams.ts index 96164b0e1f9ce..5ebef67bcec0c 100644 --- a/x-pack/test_serverless/functional/test_suites/common/management/index_management/data_streams.ts +++ b/x-pack/test_serverless/functional/test_suites/common/management/index_management/data_streams.ts @@ -19,9 +19,13 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const TEST_DS_NAME = 'test-ds-1'; - describe('Data Streams', function () { - // failsOnMKI, see https://github.com/elastic/kibana/issues/181242 - this.tags(['failsOnMKI']); + enum INDEX_MODE { + STANDARD = 'Standard', + LOGSDB = 'LogsDB', + TIME_SERIES = 'Time series', + } + + describe('Data Streams', () => { before(async () => { log.debug('Creating required data stream'); try { @@ -40,7 +44,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); await es.indices.putIndexTemplate({ - name: `${TEST_DS_NAME}_index_template`, + name: `index_template_${TEST_DS_NAME}`, index_patterns: [TEST_DS_NAME], data_stream: {}, composed_of: [`${TEST_DS_NAME}_mapping`], @@ -71,7 +75,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { try { await es.indices.deleteDataStream({ name: TEST_DS_NAME }); await es.indices.deleteIndexTemplate({ - name: `${TEST_DS_NAME}_index_template`, + name: `index_template_${TEST_DS_NAME}`, }); await es.cluster.deleteComponentTemplate({ name: `${TEST_DS_NAME}_mapping`, @@ -99,45 +103,222 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await testSubjects.click('closeDetailsButton'); }); - it('allows to update data retention', async () => { - // Open details flyout - await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME); - // Open the edit retention dialog - await testSubjects.click('manageDataStreamButton'); - await testSubjects.click('editDataRetentionButton'); - - // Disable infinite retention - await testSubjects.click('infiniteRetentionPeriod > input'); - // Set the retention to 7 hours - await testSubjects.setValue('dataRetentionValue', '7'); - await testSubjects.click('show-filters-button'); - await testSubjects.click('filter-option-h'); - - // Submit the form - await testSubjects.click('saveButton'); - - // Expect to see a success toast - const successToast = await toasts.getElementByIndex(1); - expect(await successToast.getVisibleText()).to.contain('Data retention updated'); - }); + describe('data retention', function () { + // failsOnMKI, see https://github.com/elastic/kibana/issues/181242 + this.tags(['failsOnMKI']); + it('allows to update data retention', async () => { + // Open details flyout + await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME); + // Open the edit retention dialog + await testSubjects.click('manageDataStreamButton'); + await testSubjects.click('editDataRetentionButton'); + + // Disable infinite retention + await testSubjects.click('infiniteRetentionPeriod > input'); + // Set the retention to 7 hours + await testSubjects.setValue('dataRetentionValue', '7'); + await testSubjects.click('show-filters-button'); + await testSubjects.click('filter-option-h'); + + // Submit the form + await testSubjects.click('saveButton'); + + // Expect to see a success toast + const successToast = await toasts.getElementByIndex(1); + expect(await successToast.getVisibleText()).to.contain('Data retention updated'); + }); - describe('Project level data retention checks - security solution', () => { - this.tags(['skipSvlOblt', 'skipSvlSearch']); + describe('Project level data retention checks - security solution', () => { + this.tags(['skipSvlOblt', 'skipSvlSearch']); - it('shows project data retention in the datastreams list', async () => { - expect(await testSubjects.exists('projectLevelRetentionCallout')).to.be(true); - expect(await testSubjects.exists('cloudLinkButton')).to.be(true); + it('shows project data retention in the datastreams list', async () => { + expect(await testSubjects.exists('projectLevelRetentionCallout')).to.be(true); + expect(await testSubjects.exists('cloudLinkButton')).to.be(true); + }); + }); + + it('disabling data retention in serverless is not allowed', async () => { + // Open details flyout + await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME); + // Open the edit retention dialog + await testSubjects.click('manageDataStreamButton'); + await testSubjects.click('editDataRetentionButton'); + + expect(await testSubjects.exists('dataRetentionEnabledField')).to.be(false); }); }); - it('disabling data retention in serverless is not allowed', async () => { - // Open details flyout - await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME); - // Open the edit retention dialog - await testSubjects.click('manageDataStreamButton'); - await testSubjects.click('editDataRetentionButton'); + describe('Modify data streams index mode', () => { + const TEST_DS_NAME_INDEX_MODE = 'test-ds'; + const setIndexModeTemplate = async (settings: object) => { + await es.indices.putIndexTemplate({ + name: `index_template_${TEST_DS_NAME_INDEX_MODE}`, + index_patterns: [TEST_DS_NAME_INDEX_MODE], + data_stream: {}, + template: { + settings, + }, + }); + await es.indices.createDataStream({ + name: TEST_DS_NAME_INDEX_MODE, + }); + await testSubjects.click('reloadButton'); + }; + + const verifyIndexModeIsOrigin = async (indexModeName: string) => { + // Open details flyout of data stream + await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME_INDEX_MODE); + // Check that index mode detail exists and its label is origin + expect(await testSubjects.exists('indexModeDetail')).to.be(true); + expect(await testSubjects.getVisibleText('indexModeDetail')).to.be(indexModeName); + // Close flyout + await testSubjects.click('closeDetailsButton'); + // Navigate to the templates tab + await pageObjects.indexManagement.changeTabs('templatesTab'); + await pageObjects.header.waitUntilLoadingHasFinished(); + // Edit template + await pageObjects.indexManagement.clickIndexTemplateNameLink( + `index_template_${TEST_DS_NAME_INDEX_MODE}` + ); + await testSubjects.click('manageTemplateButton'); + await testSubjects.click('editIndexTemplateButton'); + + // Verify index mode is origin + expect(await testSubjects.getVisibleText('indexModeField')).to.be(indexModeName); + }; + + const changeIndexMode = async (indexModeSelector: string) => { + // Modify index mode + await testSubjects.click('indexModeField'); + await testSubjects.click(indexModeSelector); + }; + + const verifyModeHasBeenChanged = async (indexModeName: string) => { + expect(await testSubjects.getVisibleText('indexModeValue')).to.be(indexModeName); + + // Click update template + await pageObjects.indexManagement.clickNextButton(); + + // Verify index mode and close detail tab + expect(await testSubjects.getVisibleText('indexModeValue')).to.be(indexModeName); + await testSubjects.click('closeDetailsButton'); + + // Navigate to the data streams tab + await pageObjects.indexManagement.changeTabs('data_streamsTab'); + await pageObjects.header.waitUntilLoadingHasFinished(); - expect(await testSubjects.exists('dataRetentionEnabledField')).to.be(false); + // Open data stream + await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME_INDEX_MODE); + // Check that index mode detail exists and its label is destination index mode + expect(await testSubjects.exists('indexModeDetail')).to.be(true); + expect(await testSubjects.getVisibleText('indexModeDetail')).to.be(indexModeName); + // Close flyout + await testSubjects.click('closeDetailsButton'); + }; + + before(async () => { + await pageObjects.common.navigateToApp('indexManagement'); + // Navigate to the indices tab + await pageObjects.indexManagement.changeTabs('data_streamsTab'); + await pageObjects.header.waitUntilLoadingHasFinished(); + }); + + afterEach(async () => { + await log.debug('Cleaning up created data stream'); + + try { + await es.indices.deleteDataStream({ name: TEST_DS_NAME_INDEX_MODE }); + await es.indices.deleteIndexTemplate({ + name: `index_template_${TEST_DS_NAME_INDEX_MODE}`, + }); + } catch (e) { + log.debug('Error deleting test data stream'); + throw e; + } + }); + + it('allows to upgrade data stream from standard to logsdb index mode', async () => { + await setIndexModeTemplate({ + mode: 'standard', + }); + await verifyIndexModeIsOrigin(INDEX_MODE.STANDARD); + + await changeIndexMode('index_mode_logsdb'); + // Navigate to the last step of the wizard + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + + await verifyModeHasBeenChanged(INDEX_MODE.LOGSDB); + }); + + it('allows to downgrade data stream from logsdb to standard index mode', async () => { + await setIndexModeTemplate({ + mode: 'logsdb', + }); + await verifyIndexModeIsOrigin(INDEX_MODE.LOGSDB); + + await changeIndexMode('index_mode_standard'); + // Navigate to the last step of the wizard + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + + await verifyModeHasBeenChanged(INDEX_MODE.STANDARD); + }); + + it('allows to upgrade data stream from time series to logsdb index mode', async () => { + await setIndexModeTemplate({ + mode: 'time_series', + routing_path: 'test', + }); + await verifyIndexModeIsOrigin(INDEX_MODE.TIME_SERIES); + + await changeIndexMode('index_mode_logsdb'); + + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + // Modify Index settings + await testSubjects.setValue('kibanaCodeEditor', '{}', { + clearWithKeyboard: true, + }); + // Navigate to the last step of the wizard + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + + await verifyModeHasBeenChanged(INDEX_MODE.LOGSDB); + }); + + it('allows to downgrade data stream from logsdb to time series index mode', async () => { + await setIndexModeTemplate({ + mode: 'logsdb', + }); + await verifyIndexModeIsOrigin(INDEX_MODE.LOGSDB); + + await changeIndexMode('index_mode_time_series'); + + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + // Modify Index settings + await testSubjects.setValue( + 'kibanaCodeEditor', + JSON.stringify({ index: { mode: 'time_series', routing_path: 'test' } }), + { + clearWithKeyboard: true, + } + ); + // Navigate to the last step of the wizard + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + await testSubjects.click('nextButton'); + + await verifyModeHasBeenChanged(INDEX_MODE.TIME_SERIES); + }); }); }); }; diff --git a/x-pack/test_serverless/functional/test_suites/common/management/index_management/index_templates.ts b/x-pack/test_serverless/functional/test_suites/common/management/index_management/index_templates.ts index 1a98bea48e940..30ed3c30104e3 100644 --- a/x-pack/test_serverless/functional/test_suites/common/management/index_management/index_templates.ts +++ b/x-pack/test_serverless/functional/test_suites/common/management/index_management/index_templates.ts @@ -86,7 +86,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('Create index template', () => { const TEST_TEMPLATE_NAME = `test_template_${Date.now()}`; - after(async () => { + afterEach(async () => { await es.indices.deleteIndexTemplate({ name: TEST_TEMPLATE_NAME }, { ignore: [404] }); }); @@ -103,6 +103,28 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await retry.try(async () => { expect(await testSubjects.getVisibleText('title')).to.contain(TEST_TEMPLATE_NAME); }); + await testSubjects.click('closeDetailsButton'); + }); + + it('can create an index template with logsdb index mode', async () => { + await testSubjects.click('createTemplateButton'); + // Fill out required fields + await testSubjects.setValue('nameField', TEST_TEMPLATE_NAME); + await testSubjects.setValue('indexPatternsField', INDEX_PATTERN); + + await testSubjects.click('indexModeField'); + await testSubjects.click('index_mode_logsdb'); + + // Click form summary step and then the submit button + await testSubjects.click('formWizardStep-5'); + expect(await testSubjects.getVisibleText('indexModeValue')).to.be('LogsDB'); + + // Click update template + await pageObjects.indexManagement.clickNextButton(); + + // Close detail tab + expect(await testSubjects.getVisibleText('indexModeValue')).to.be('LogsDB'); + await testSubjects.click('closeDetailsButton'); }); }); });