From c1b247e3cbdd261d43b5d2e879d7d70fab52c04a Mon Sep 17 00:00:00 2001 From: Charis Kalpakis <39087493+fake-haris@users.noreply.github.com> Date: Fri, 29 Nov 2024 16:21:20 +0200 Subject: [PATCH] Balance lens group4 config --- .buildkite/ftr_platform_stateful_configs.yml | 1 + .../test/functional/apps/lens/group4/index.ts | 3 +- .../test/functional/apps/lens/group4/tsdb.ts | 2 +- .../functional/apps/lens/group7/config.ts | 17 ++++ .../test/functional/apps/lens/group7/index.ts | 77 +++++++++++++++++++ .../apps/lens/{group4 => group7}/logsdb.ts | 2 +- .../lens/{group4 => }/tsdb_logsdb_helpers.ts | 2 +- 7 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 x-pack/test/functional/apps/lens/group7/config.ts create mode 100644 x-pack/test/functional/apps/lens/group7/index.ts rename x-pack/test/functional/apps/lens/{group4 => group7}/logsdb.ts (99%) rename x-pack/test/functional/apps/lens/{group4 => }/tsdb_logsdb_helpers.ts (99%) diff --git a/.buildkite/ftr_platform_stateful_configs.yml b/.buildkite/ftr_platform_stateful_configs.yml index f55fc2f7b4898..bc323bfb6c5bf 100644 --- a/.buildkite/ftr_platform_stateful_configs.yml +++ b/.buildkite/ftr_platform_stateful_configs.yml @@ -231,6 +231,7 @@ enabled: - x-pack/test/functional/apps/lens/group4/config.ts - x-pack/test/functional/apps/lens/group5/config.ts - x-pack/test/functional/apps/lens/group6/config.ts + - x-pack/test/functional/apps/lens/group7/config.ts - x-pack/test/functional/apps/lens/open_in_lens/tsvb/config.ts - x-pack/test/functional/apps/lens/open_in_lens/agg_based/config.ts - x-pack/test/functional/apps/lens/open_in_lens/dashboard/config.ts diff --git a/x-pack/test/functional/apps/lens/group4/index.ts b/x-pack/test/functional/apps/lens/group4/index.ts index 61074d6aa6d78..7caadad31c120 100644 --- a/x-pack/test/functional/apps/lens/group4/index.ts +++ b/x-pack/test/functional/apps/lens/group4/index.ts @@ -81,7 +81,6 @@ export default ({ getService, loadTestFile, getPageObjects }: FtrProviderContext loadTestFile(require.resolve('./show_underlying_data_dashboard')); // 2m 10s loadTestFile(require.resolve('./share')); // 1m 20s // keep it last in the group - loadTestFile(require.resolve('./tsdb')); // 1m - loadTestFile(require.resolve('./logsdb')); // 1m + loadTestFile(require.resolve('./tsdb')); // 3m 56s }); }; diff --git a/x-pack/test/functional/apps/lens/group4/tsdb.ts b/x-pack/test/functional/apps/lens/group4/tsdb.ts index 3a6aac5ffa39b..3834fc837b9d2 100644 --- a/x-pack/test/functional/apps/lens/group4/tsdb.ts +++ b/x-pack/test/functional/apps/lens/group4/tsdb.ts @@ -17,7 +17,7 @@ import { getDocsGenerator, setupScenarioRunner, sumFirstNValues, -} from './tsdb_logsdb_helpers'; +} from '../tsdb_logsdb_helpers'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const { common, lens, dashboard } = getPageObjects(['common', 'lens', 'dashboard']); diff --git a/x-pack/test/functional/apps/lens/group7/config.ts b/x-pack/test/functional/apps/lens/group7/config.ts new file mode 100644 index 0000000000000..d927f93adeffd --- /dev/null +++ b/x-pack/test/functional/apps/lens/group7/config.ts @@ -0,0 +1,17 @@ +/* + * 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. + */ + +import { FtrConfigProviderContext } from '@kbn/test'; + +export default async function ({ readConfigFile }: FtrConfigProviderContext) { + const functionalConfig = await readConfigFile(require.resolve('../../../config.base.js')); + + return { + ...functionalConfig.getAll(), + testFiles: [require.resolve('.')], + }; +} diff --git a/x-pack/test/functional/apps/lens/group7/index.ts b/x-pack/test/functional/apps/lens/group7/index.ts new file mode 100644 index 0000000000000..0ef20e0530815 --- /dev/null +++ b/x-pack/test/functional/apps/lens/group7/index.ts @@ -0,0 +1,77 @@ +/* + * 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. + */ + +import { EsArchiver } from '@kbn/es-archiver'; +import { FtrProviderContext } from '../../../ftr_provider_context'; + +export default ({ getService, loadTestFile, getPageObjects }: FtrProviderContext) => { + const browser = getService('browser'); + const log = getService('log'); + const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); + const { timePicker } = getPageObjects(['timePicker']); + const config = getService('config'); + let remoteEsArchiver; + + describe('lens app - group 4', () => { + const esArchive = 'x-pack/test/functional/es_archives/logstash_functional'; + const localIndexPatternString = 'logstash-*'; + const remoteIndexPatternString = 'ftr-remote:logstash-*'; + const localFixtures = { + lensBasic: 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json', + lensDefault: 'x-pack/test/functional/fixtures/kbn_archiver/lens/default', + }; + + const remoteFixtures = { + lensBasic: 'x-pack/test/functional/fixtures/kbn_archiver/lens/ccs/lens_basic.json', + lensDefault: 'x-pack/test/functional/fixtures/kbn_archiver/lens/ccs/default', + }; + let esNode: EsArchiver; + let fixtureDirs: { + lensBasic: string; + lensDefault: string; + }; + let indexPatternString: string; + before(async () => { + await log.debug('Starting lens before method'); + await browser.setWindowSize(1280, 1200); + await kibanaServer.savedObjects.cleanStandardList(); + try { + config.get('esTestCluster.ccs'); + remoteEsArchiver = getService('remoteEsArchiver' as 'esArchiver'); + esNode = remoteEsArchiver; + fixtureDirs = remoteFixtures; + indexPatternString = remoteIndexPatternString; + } catch (error) { + esNode = esArchiver; + fixtureDirs = localFixtures; + indexPatternString = localIndexPatternString; + } + + await esNode.load(esArchive); + // changing the timepicker default here saves us from having to set it in Discover (~8s) + await timePicker.setDefaultAbsoluteRangeViaUiSettings(); + await kibanaServer.uiSettings.update({ + defaultIndex: indexPatternString, + 'dateFormat:tz': 'UTC', + }); + await kibanaServer.importExport.load(fixtureDirs.lensBasic); + await kibanaServer.importExport.load(fixtureDirs.lensDefault); + }); + + after(async () => { + await esArchiver.unload(esArchive); + await timePicker.resetDefaultAbsoluteRangeViaUiSettings(); + await kibanaServer.importExport.unload(fixtureDirs.lensBasic); + await kibanaServer.importExport.unload(fixtureDirs.lensDefault); + await kibanaServer.savedObjects.cleanStandardList(); + }); + + // total run time ~30m + loadTestFile(require.resolve('./logsdb')); // 30m + }); +}; diff --git a/x-pack/test/functional/apps/lens/group4/logsdb.ts b/x-pack/test/functional/apps/lens/group7/logsdb.ts similarity index 99% rename from x-pack/test/functional/apps/lens/group4/logsdb.ts rename to x-pack/test/functional/apps/lens/group7/logsdb.ts index 8071ad58ac09a..5aeff039c4889 100644 --- a/x-pack/test/functional/apps/lens/group4/logsdb.ts +++ b/x-pack/test/functional/apps/lens/group7/logsdb.ts @@ -14,7 +14,7 @@ import { getDocsGenerator, setupScenarioRunner, TIME_PICKER_FORMAT, -} from './tsdb_logsdb_helpers'; +} from '../tsdb_logsdb_helpers'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const { common, lens, discover, header, timePicker } = getPageObjects([ diff --git a/x-pack/test/functional/apps/lens/group4/tsdb_logsdb_helpers.ts b/x-pack/test/functional/apps/lens/tsdb_logsdb_helpers.ts similarity index 99% rename from x-pack/test/functional/apps/lens/group4/tsdb_logsdb_helpers.ts rename to x-pack/test/functional/apps/lens/tsdb_logsdb_helpers.ts index e0169ebbae575..d68040de27ae9 100644 --- a/x-pack/test/functional/apps/lens/group4/tsdb_logsdb_helpers.ts +++ b/x-pack/test/functional/apps/lens/tsdb_logsdb_helpers.ts @@ -9,7 +9,7 @@ import { Client } from '@elastic/elasticsearch'; import { MappingProperty } from '@elastic/elasticsearch/lib/api/types'; import { ToolingLog } from '@kbn/tooling-log'; import moment from 'moment'; -import type { FtrProviderContext } from '../../../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export const TEST_DOC_COUNT = 100; export const TIME_PICKER_FORMAT = 'MMM D, YYYY [@] HH:mm:ss.SSS';