Skip to content

Commit a2b6b97

Browse files
[8.19] [Data Streams] Fix forward-compatibility test failures (#223129) (#223226)
# Backport This will backport the following commits from `main` to `8.19`: - [[Data Streams] Fix forward-compatibility test failures (#223129)](#223129) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Elena Stoeva","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-06-10T12:38:54Z","message":"[Data Streams] Fix forward-compatibility test failures (#223129)\n\nFixes https://github.com/elastic/kibana/issues/221224\n\n## Summary\n\nThis PR fixes the forward-compatibility test for index mode, which\nfailed because the index mode was added to Get Data Streams API in 8.19\nand 9.1 (see elastic/elasticsearch#122486), so\nif Kibana 8.19 is run with Es 9.0, the index mode is always displayed as\n\"Standard\" because Es doesn't return an index mode field.\n\nIn this PR, we separate all index mode-related tests into a separate\nfile, and only run it for Es versions 8.19 or 9.1+.","sha":"d12b19608af35df7ad1c3b38371819b90c926676","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Index Management","Team:Kibana Management","release_note:skip","backport:version","v9.1.0","v8.19.0"],"title":"[Data Streams] Fix forward-compatibility test failures","number":223129,"url":"https://github.com/elastic/kibana/pull/223129","mergeCommit":{"message":"[Data Streams] Fix forward-compatibility test failures (#223129)\n\nFixes https://github.com/elastic/kibana/issues/221224\n\n## Summary\n\nThis PR fixes the forward-compatibility test for index mode, which\nfailed because the index mode was added to Get Data Streams API in 8.19\nand 9.1 (see elastic/elasticsearch#122486), so\nif Kibana 8.19 is run with Es 9.0, the index mode is always displayed as\n\"Standard\" because Es doesn't return an index mode field.\n\nIn this PR, we separate all index mode-related tests into a separate\nfile, and only run it for Es versions 8.19 or 9.1+.","sha":"d12b19608af35df7ad1c3b38371819b90c926676"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/223129","number":223129,"mergeCommit":{"message":"[Data Streams] Fix forward-compatibility test failures (#223129)\n\nFixes https://github.com/elastic/kibana/issues/221224\n\n## Summary\n\nThis PR fixes the forward-compatibility test for index mode, which\nfailed because the index mode was added to Get Data Streams API in 8.19\nand 9.1 (see elastic/elasticsearch#122486), so\nif Kibana 8.19 is run with Es 9.0, the index mode is always displayed as\n\"Standard\" because Es doesn't return an index mode field.\n\nIn this PR, we separate all index mode-related tests into a separate\nfile, and only run it for Es versions 8.19 or 9.1+.","sha":"d12b19608af35df7ad1c3b38371819b90c926676"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Elena Stoeva <[email protected]>
1 parent 526b903 commit a2b6b97

File tree

3 files changed

+303
-214
lines changed

3 files changed

+303
-214
lines changed

x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts

Lines changed: 0 additions & 214 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
1717
const security = getService('security');
1818
const testSubjects = getService('testSubjects');
1919

20-
enum INDEX_MODE {
21-
STANDARD = 'Standard',
22-
LOGSDB = 'LogsDB',
23-
TIME_SERIES = 'Time series',
24-
}
25-
2620
const TEST_DS_NAME_1 = 'test-ds-1';
2721
const TEST_DS_NAME_2 = 'test-ds-2';
2822
const TEST_DATA_STREAM_NAMES = [TEST_DS_NAME_1, TEST_DS_NAME_2];
@@ -99,48 +93,6 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
9993
await testSubjects.click('closeDetailsButton');
10094
});
10195

102-
describe('shows the correct index mode in the details flyout', function () {
103-
it('standard index mode', async () => {
104-
// Open details flyout of existing data stream - it has standard index mode
105-
await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME_1);
106-
// Check that index mode detail exists and its label is "Standard"
107-
expect(await testSubjects.exists('indexModeDetail')).to.be(true);
108-
expect(await testSubjects.getVisibleText('indexModeDetail')).to.be('Standard');
109-
// Close flyout
110-
await testSubjects.click('closeDetailsButton');
111-
});
112-
113-
it('logsdb index mode', async () => {
114-
// Create an index template with a logsdb index mode
115-
await es.indices.putIndexTemplate({
116-
name: `logsdb_index_template`,
117-
index_patterns: ['test-logsdb'],
118-
data_stream: {},
119-
template: {
120-
settings: { mode: 'logsdb' },
121-
},
122-
});
123-
// Create a data stream matching the index pattern of the index template above
124-
await es.indices.createDataStream({
125-
name: 'test-logsdb',
126-
});
127-
await browser.refresh();
128-
// Open details flyout of data stream
129-
await pageObjects.indexManagement.clickDataStreamNameLink('test-logsdb');
130-
// Check that index mode detail exists and its label is "LogsDB"
131-
expect(await testSubjects.exists('indexModeDetail')).to.be(true);
132-
expect(await testSubjects.getVisibleText('indexModeDetail')).to.be('LogsDB');
133-
// Close flyout
134-
await testSubjects.click('closeDetailsButton');
135-
// Delete data stream and index template
136-
await es.indices.deleteDataStream({ name: 'test-logsdb' });
137-
await es.indices.deleteIndexTemplate({
138-
name: `logsdb_index_template`,
139-
});
140-
await testSubjects.click('reloadButton');
141-
});
142-
});
143-
14496
describe('data retention modal', function () {
14597
describe('from details panel', function () {
14698
it('allows to update data retention', async () => {
@@ -230,171 +182,5 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
230182
});
231183
});
232184
});
233-
234-
describe('Modify data streams index mode', () => {
235-
const TEST_DS_NAME = 'test-ds';
236-
const setIndexModeTemplate = async (settings: object) => {
237-
await es.indices.putIndexTemplate({
238-
name: `index_template_${TEST_DS_NAME}`,
239-
index_patterns: [TEST_DS_NAME],
240-
data_stream: {},
241-
template: {
242-
settings,
243-
},
244-
});
245-
await es.indices.createDataStream({
246-
name: TEST_DS_NAME,
247-
});
248-
await testSubjects.click('reloadButton');
249-
};
250-
251-
const verifyIndexModeIsOrigin = async (indexModeName: string) => {
252-
// Open details flyout of data stream
253-
await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME);
254-
// Check that index mode detail exists and its label is origin
255-
expect(await testSubjects.exists('indexModeDetail')).to.be(true);
256-
expect(await testSubjects.getVisibleText('indexModeDetail')).to.be(indexModeName);
257-
// Close flyout
258-
await testSubjects.click('closeDetailsButton');
259-
// Navigate to the templates tab
260-
await pageObjects.indexManagement.changeTabs('templatesTab');
261-
await pageObjects.header.waitUntilLoadingHasFinished();
262-
// Edit template
263-
await pageObjects.indexManagement.clickIndexTemplateNameLink(
264-
`index_template_${TEST_DS_NAME}`
265-
);
266-
await testSubjects.click('manageTemplateButton');
267-
await testSubjects.click('editIndexTemplateButton');
268-
269-
// Verify index mode is origin
270-
expect(await testSubjects.getVisibleText('indexModeField')).to.be(indexModeName);
271-
};
272-
273-
const changeIndexMode = async (indexModeSelector: string) => {
274-
// Modify index mode
275-
await testSubjects.click('indexModeField');
276-
await testSubjects.click(indexModeSelector);
277-
};
278-
279-
const verifyModeHasBeenChanged = async (indexModeName: string) => {
280-
expect(await testSubjects.getVisibleText('indexModeValue')).to.be(indexModeName);
281-
282-
// Click update template
283-
await pageObjects.indexManagement.clickNextButton();
284-
await pageObjects.header.waitUntilLoadingHasFinished();
285-
286-
// Verify index mode and close detail tab
287-
expect(await testSubjects.getVisibleText('indexModeValue')).to.be(indexModeName);
288-
await testSubjects.click('closeDetailsButton');
289-
290-
// Perform rollover so that index mode of data stream is updated
291-
await es.indices.rollover({
292-
alias: TEST_DS_NAME,
293-
});
294-
295-
// Navigate to the data streams tab
296-
await pageObjects.indexManagement.changeTabs('data_streamsTab');
297-
await pageObjects.header.waitUntilLoadingHasFinished();
298-
299-
// Open data stream
300-
await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME);
301-
// Check that index mode detail exists and its label is destination index mode
302-
expect(await testSubjects.exists('indexModeDetail')).to.be(true);
303-
expect(await testSubjects.getVisibleText('indexModeDetail')).to.be(indexModeName);
304-
// Close flyout
305-
await testSubjects.click('closeDetailsButton');
306-
};
307-
308-
afterEach(async () => {
309-
await log.debug('Cleaning up created data stream');
310-
311-
try {
312-
await es.indices.deleteDataStream({ name: TEST_DS_NAME });
313-
await es.indices.deleteIndexTemplate({
314-
name: `index_template_${TEST_DS_NAME}`,
315-
});
316-
} catch (e) {
317-
log.debug('Error deleting test data stream');
318-
throw e;
319-
}
320-
});
321-
322-
it('allows to upgrade data stream from standard to logsdb index mode', async () => {
323-
await setIndexModeTemplate({
324-
mode: 'standard',
325-
});
326-
await verifyIndexModeIsOrigin(INDEX_MODE.STANDARD);
327-
328-
await changeIndexMode('index_mode_logsdb');
329-
// Navigate to the last step of the wizard
330-
await testSubjects.click('formWizardStep-5');
331-
await pageObjects.header.waitUntilLoadingHasFinished();
332-
333-
await verifyModeHasBeenChanged(INDEX_MODE.LOGSDB);
334-
});
335-
336-
it('allows to downgrade data stream from logsdb to standard index mode', async () => {
337-
await setIndexModeTemplate({
338-
mode: 'logsdb',
339-
});
340-
await verifyIndexModeIsOrigin(INDEX_MODE.LOGSDB);
341-
342-
await changeIndexMode('index_mode_standard');
343-
// Navigate to the last step of the wizard
344-
await testSubjects.click('formWizardStep-5');
345-
await pageObjects.header.waitUntilLoadingHasFinished();
346-
347-
await verifyModeHasBeenChanged(INDEX_MODE.STANDARD);
348-
});
349-
350-
// Fails because of https://github.com/elastic/elasticsearch/issues/126473
351-
it.skip('allows to upgrade data stream from time series to logsdb index mode', async () => {
352-
await setIndexModeTemplate({
353-
mode: 'time_series',
354-
routing_path: 'test',
355-
});
356-
await verifyIndexModeIsOrigin(INDEX_MODE.TIME_SERIES);
357-
358-
await changeIndexMode('index_mode_logsdb');
359-
360-
await testSubjects.click('formWizardStep-2');
361-
await pageObjects.header.waitUntilLoadingHasFinished();
362-
// Modify Index settings
363-
await testSubjects.setValue('kibanaCodeEditor', '{}', {
364-
clearWithKeyboard: true,
365-
});
366-
// Navigate to the last step of the wizard
367-
await testSubjects.click('formWizardStep-5');
368-
await pageObjects.header.waitUntilLoadingHasFinished();
369-
370-
await verifyModeHasBeenChanged(INDEX_MODE.LOGSDB);
371-
});
372-
373-
// Fails because of https://github.com/elastic/elasticsearch/issues/126473
374-
it.skip('allows to downgrade data stream from logsdb to time series index mode', async () => {
375-
await setIndexModeTemplate({
376-
mode: 'logsdb',
377-
});
378-
await verifyIndexModeIsOrigin(INDEX_MODE.LOGSDB);
379-
380-
await changeIndexMode('index_mode_time_series');
381-
382-
await testSubjects.click('formWizardStep-2');
383-
await pageObjects.header.waitUntilLoadingHasFinished();
384-
// Modify Index settings
385-
await testSubjects.setValue(
386-
'kibanaCodeEditor',
387-
JSON.stringify({ index: { mode: 'time_series', routing_path: 'test' } }),
388-
{
389-
clearWithKeyboard: true,
390-
}
391-
);
392-
// Navigate to the last step of the wizard
393-
await testSubjects.click('formWizardStep-5');
394-
await pageObjects.header.waitUntilLoadingHasFinished();
395-
396-
await verifyModeHasBeenChanged(INDEX_MODE.TIME_SERIES);
397-
});
398-
});
399185
});
400186
};

x-pack/test/functional/apps/index_management/data_streams_tab/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
1010
export default ({ loadTestFile }: FtrProviderContext) => {
1111
describe('Index Management: data streams tab', function () {
1212
loadTestFile(require.resolve('./data_streams_tab'));
13+
loadTestFile(require.resolve('./index_mode'));
1314
});
1415
};

0 commit comments

Comments
 (0)