From 05f4e98c8c9843ceb5940ad1feedaf5f5d8d50a6 Mon Sep 17 00:00:00 2001 From: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com> Date: Mon, 15 Jul 2024 21:46:59 +0100 Subject: [PATCH] [7.17][Rollup] Unskip 7.17 rollup functional tests (#187350) Fixes https://github.com/elastic/kibana/issues/184229 Fixes https://github.com/elastic/kibana/issues/184230 Fixes https://github.com/elastic/kibana/issues/184277 Fixes https://github.com/elastic/kibana/issues/184278 Fixes https://github.com/elastic/kibana/issues/184357 Fixes https://github.com/elastic/kibana/issues/57065 ## Summary This PR unskips the 7.17 rollup functional tests which failed during the 7.17 ES 8.15 forward compatibility tests. To run the tests locally with ES 8.15: ``` ES_SNAPSHOT_MANIFEST="https://storage.googleapis.com/kibana-ci-es-snapshots-daily/8.15.0/manifest-latest-verified.json" node scripts/functional_tests_server.js --config x-pack/test/functional/config.js ``` ``` ES_SNAPSHOT_MANIFEST="https://storage.googleapis.com/kibana-ci-es-snapshots-daily/8.15.0/manifest-latest-verified.json" node scripts/functional_test_runner.js --config x-pack/test/functional/config.js --grep="rollup job" ``` --------- Co-authored-by: Elastic Machine Co-authored-by: Alison Goryachev --- .../apps/rollup_job/hybrid_index_pattern.js | 11 +++-- .../functional/apps/rollup_job/rollup_jobs.js | 12 +++-- .../apps/rollup_job/test_helpers.js | 45 +++++++++++++++++++ .../test/functional/apps/rollup_job/tsvb.js | 16 +++++-- 4 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 x-pack/test/functional/apps/rollup_job/test_helpers.js diff --git a/x-pack/test/functional/apps/rollup_job/hybrid_index_pattern.js b/x-pack/test/functional/apps/rollup_job/hybrid_index_pattern.js index 102206096edec..c86f755a4fa5a 100644 --- a/x-pack/test/functional/apps/rollup_job/hybrid_index_pattern.js +++ b/x-pack/test/functional/apps/rollup_job/hybrid_index_pattern.js @@ -8,6 +8,7 @@ import datemath from '@elastic/datemath'; import expect from '@kbn/expect'; import mockRolledUpData, { mockIndices } from './hybrid_index_helper'; +import { MOCK_ROLLUP_INDEX_NAME, createMockRollupIndex } from './test_helpers'; export default function ({ getService, getPageObjects }) { const es = getService('es'); @@ -17,9 +18,7 @@ export default function ({ getService, getPageObjects }) { const PageObjects = getPageObjects(['common', 'settings']); const esDeleteAllIndices = getService('esDeleteAllIndices'); - // Failing: See https://github.com/elastic/kibana/issues/184278 - // Failing: See https://github.com/elastic/kibana/issues/184277 - describe.skip('hybrid index pattern', function () { + describe('hybrid index pattern', function () { //Since rollups can only be created once with the same name (even if you delete it), //we add the Date.now() to avoid name collision if you run the tests locally back to back. const rollupJobName = `hybrid-index-pattern-test-rollup-job-${Date.now()}`; @@ -46,6 +45,11 @@ export default function ({ getService, getPageObjects }) { await kibanaServer.uiSettings.replace({ defaultIndex: 'rollup', }); + + // The step below is done for the 7.17 ES 8.x forward compatibility tests + // From 8.15, Es only allows creating a new rollup job when there is existing rollup usage in the cluster + // We will simulate rollup usage by creating a mock-up rollup index + await createMockRollupIndex(es); }); it('create hybrid index pattern', async () => { @@ -121,6 +125,7 @@ export default function ({ getService, getPageObjects }) { rollupTargetIndexName, `${regularIndexPrefix}*`, `${rollupSourceIndexPrefix}*`, + MOCK_ROLLUP_INDEX_NAME, ]); await kibanaServer.importExport.unload( 'x-pack/test/functional/fixtures/kbn_archiver/rollup/rollup_hybrid' diff --git a/x-pack/test/functional/apps/rollup_job/rollup_jobs.js b/x-pack/test/functional/apps/rollup_job/rollup_jobs.js index bed6ccbc6e620..6c965dd76ba53 100644 --- a/x-pack/test/functional/apps/rollup_job/rollup_jobs.js +++ b/x-pack/test/functional/apps/rollup_job/rollup_jobs.js @@ -8,6 +8,7 @@ import datemath from '@elastic/datemath'; import expect from '@kbn/expect'; import { mockIndices } from './hybrid_index_helper'; +import { MOCK_ROLLUP_INDEX_NAME, createMockRollupIndex } from './test_helpers'; export default function ({ getService, getPageObjects }) { const es = getService('es'); @@ -16,9 +17,7 @@ export default function ({ getService, getPageObjects }) { const security = getService('security'); const esDeleteAllIndices = getService('esDeleteAllIndices'); - // Failing: See https://github.com/elastic/kibana/issues/184230 - // Failing: See https://github.com/elastic/kibana/issues/184229 - describe.skip('rollup job', function () { + describe('rollup job', function () { //Since rollups can only be created once with the same name (even if you delete it), //we add the Date.now() to avoid name collision. const rollupJobName = 'rollup-to-be-' + Date.now(); @@ -36,6 +35,11 @@ export default function ({ getService, getPageObjects }) { before(async () => { await security.testUser.setRoles(['manage_rollups_role']); await PageObjects.common.navigateToApp('rollupJob'); + + // The step below is done for the 7.17 ES 8.15 forward compatibility tests + // From 8.15, Es only allows creating a new rollup job when there is existing rollup usage in the cluster + // We will simulate rollup usage by creating a mock-up rollup index + await createMockRollupIndex(es); }); it('create new rollup job', async () => { @@ -72,7 +76,7 @@ export default function ({ getService, getPageObjects }) { }); //Delete all data indices that were created. - await esDeleteAllIndices([targetIndexName, rollupSourceIndexPattern]); + await esDeleteAllIndices([targetIndexName, rollupSourceIndexPattern, MOCK_ROLLUP_INDEX_NAME]); await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana'); await security.testUser.restoreDefaults(); }); diff --git a/x-pack/test/functional/apps/rollup_job/test_helpers.js b/x-pack/test/functional/apps/rollup_job/test_helpers.js new file mode 100644 index 0000000000000..5d71339946527 --- /dev/null +++ b/x-pack/test/functional/apps/rollup_job/test_helpers.js @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const MOCK_ROLLUP_INDEX_NAME = 'mock-rollup-index'; + +export const createMockRollupIndex = async (es) => { + await es.indices.create({ + index: MOCK_ROLLUP_INDEX_NAME, + body: { + mappings: { + _meta: { + _rollup: { + logs_job: { + id: 'mockRollupJob', + index_pattern: MOCK_ROLLUP_INDEX_NAME, + rollup_index: 'rollup_index', + cron: '0 0 0 ? * 7', + page_size: 1000, + groups: { + date_histogram: { + interval: '24h', + delay: '1d', + time_zone: 'UTC', + field: 'testCreatedField', + }, + terms: { + fields: ['testTotalField', 'testTagField'], + }, + histogram: { + interval: '7', + fields: ['testTotalField'], + }, + }, + }, + }, + 'rollup-version': '', + }, + }, + }, + }); +}; diff --git a/x-pack/test/functional/apps/rollup_job/tsvb.js b/x-pack/test/functional/apps/rollup_job/tsvb.js index 561abc78f71af..1e68b288b23e8 100644 --- a/x-pack/test/functional/apps/rollup_job/tsvb.js +++ b/x-pack/test/functional/apps/rollup_job/tsvb.js @@ -7,6 +7,7 @@ import expect from '@kbn/expect'; import mockRolledUpData from './hybrid_index_helper'; +import { MOCK_ROLLUP_INDEX_NAME, createMockRollupIndex } from './test_helpers'; export default function ({ getService, getPageObjects }) { const es = getService('es'); @@ -22,9 +23,7 @@ export default function ({ getService, getPageObjects }) { 'timePicker', ]); - // Failing: See https://github.com/elastic/kibana/issues/57065 - // Failing: See https://github.com/elastic/kibana/issues/184357 - describe.skip('tsvb integration', function () { + describe('tsvb integration', function () { //Since rollups can only be created once with the same name (even if you delete it), //we add the Date.now() to avoid name collision if you run the tests locally back to back. const rollupJobName = `tsvb-test-rollup-job-${Date.now()}`; @@ -45,6 +44,11 @@ export default function ({ getService, getPageObjects }) { await kibanaServer.uiSettings.replace({ defaultIndex: 'rollup', }); + + // The step below is done for the 7.17 ES 8.15 forward compatibility tests + // From 8.15, Es only allows creating a new rollup job when there is existing rollup usage in the cluster + // We will simulate rollup usage by creating a mock-up rollup index + await createMockRollupIndex(es); }); it('create rollup tsvb', async () => { @@ -108,7 +112,11 @@ export default function ({ getService, getPageObjects }) { method: 'DELETE', }); - await esDeleteAllIndices([rollupTargetIndexName, rollupSourceIndexName]); + await esDeleteAllIndices([ + rollupTargetIndexName, + rollupSourceIndexName, + MOCK_ROLLUP_INDEX_NAME, + ]); await kibanaServer.importExport.unload( 'x-pack/test/functional/fixtures/kbn_archiver/rollup/rollup.json' );