Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens][FTR] Isolate logsDB and TSDB tests into separate suites #200007

Closed
wants to merge 9 commits into from
1 change: 1 addition & 0 deletions .buildkite/ftr_platform_stateful_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions x-pack/test/functional/apps/lens/group4/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export default ({ getService, loadTestFile, getPageObjects }: FtrProviderContext
await kibanaServer.savedObjects.cleanStandardList();
});

// total run time ~16m 30s
loadTestFile(require.resolve('./colors')); // 1m 2s
loadTestFile(require.resolve('./color_mapping'));
loadTestFile(require.resolve('./chart_data')); // 1m 10s
Expand All @@ -80,8 +79,6 @@ export default ({ getService, loadTestFile, getPageObjects }: FtrProviderContext
loadTestFile(require.resolve('./show_underlying_data')); // 2m
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'));
});
};
60 changes: 19 additions & 41 deletions x-pack/test/functional/apps/lens/group4/tsdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand All @@ -37,8 +37,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const tsdbIndex = 'kibana_sample_data_logstsdb';
const tsdbDataView = tsdbIndex;
const tsdbEsArchive = 'test/functional/fixtures/es_archiver/kibana_sample_data_logs_tsdb';
const fromTime = 'Apr 16, 2023 @ 00:00:00.000';
const toTime = 'Jun 16, 2023 @ 00:00:00.000';

before(async () => {
log.info(`loading ${tsdbIndex} index...`);
Expand All @@ -53,9 +51,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
);
log.info(`updating settings to use the "${tsdbDataView}" dataView...`);
await kibanaServer.uiSettings.update({
'dateFormat:tz': 'UTC',
defaultIndex: '0ae0bc7a-e4ca-405c-ab67-f2b5913f2a51',
'timepicker:timeDefaults': `{ "from": "${fromTime}", "to": "${toTime}" }`,
});
});

Expand Down Expand Up @@ -96,9 +92,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(await lens.getDimensionTriggerText('lnsXY_yDimensionPanel')).to.eql(
'Median of bytes_gauge'
);
});

it('does not show a warning', async () => {
// does not show a warning
await lens.openDimensionEditor('lnsXY_yDimensionPanel');
await testSubjects.missingOrFail('median-partial-warning');
await lens.assertNoEditorWarning();
Expand All @@ -107,16 +101,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

describe('for rolled up metric (downsampled)', () => {
it('defaults to average for rolled up metric', async () => {
it('defaults to average for rolled up metric and shows warning for unsupported metrics', async () => {
await lens.switchDataPanelIndexPattern(downsampleDataView.dataView);
await lens.removeLayer();
await lens.waitForField('bytes_gauge');
await lens.dragFieldToWorkspace('bytes_gauge', 'xyVisChart');
expect(await lens.getDimensionTriggerText('lnsXY_yDimensionPanel')).to.eql(
'Average of bytes_gauge'
);
});
it('shows warnings in editor when using median', async () => {
// shows warnings in editor when using median
await lens.openDimensionEditor('lnsXY_yDimensionPanel');
await testSubjects.existOrFail('median-partial-warning');
await testSubjects.click('lns-indexPatternDimension-median');
Expand All @@ -125,8 +118,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'Median of bytes_gauge uses a function that is unsupported by rolled up data. Select a different function or change the time range.',
'warning'
);
});
it('shows warnings in dashboards as well', async () => {
// shows warnings in dashboards as well
await lens.save('New', false, false, false, 'new');

await dashboard.waitForRenderComplete();
Expand All @@ -142,7 +134,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
before(async () => {
await common.navigateToApp('lens');
await lens.switchDataPanelIndexPattern(tsdbDataView);
await lens.goToTimeRange();
// await lens.goToTimeRange();
});

afterEach(async () => {
Expand Down Expand Up @@ -270,7 +262,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}

describe('show time series dimension groups within breakdown', () => {
it('should show the time series dimension group on field picker when configuring a breakdown', async () => {
it('should show the time series dimension group on field picker only for breakdown', async () => {
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
operation: 'date_histogram',
Expand All @@ -289,24 +281,19 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
keepOpen: true,
});

const list = await comboBox.getOptionsList('indexPattern-dimension-field');
let list = await comboBox.getOptionsList('indexPattern-dimension-field');
expect(list).to.contain('Time series dimensions');
await lens.closeDimensionEditor();
});

it("should not show the time series dimension group on field picker if it's not a breakdown", async () => {
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
operation: 'min',
field: 'bytes_counter',
});
// now check that for the x axis dimension it won't show it
await lens.removeDimension('lnsXY_xDimensionPanel');

await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
operation: 'date_histogram',
operation: 'terms',
keepOpen: true,
});
const list = await comboBox.getOptionsList('indexPattern-dimension-field');
list = await comboBox.getOptionsList('indexPattern-dimension-field');
expect(list).to.not.contain('Time series dimensions');
await lens.closeDimensionEditor();
});
Expand Down Expand Up @@ -412,14 +399,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
})
).to.eql(false);
await lens.closeDimensionEditor();
});

it(`should visualize a date histogram chart for counter field`, async () => {
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
operation: 'date_histogram',
field: '@timestamp',
});
// should visualize a date histogram chart for counter field
await lens.removeDimension('lnsXY_yDimensionPanel');

// check the counter field works
await lens.configureDimension({
Expand Down Expand Up @@ -514,15 +496,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
})
).to.eql(indexes.some(({ mode }) => mode === 'tsdb'));
await lens.closeDimensionEditor();
});

it(`should visualize a date histogram chart for counter field`, async () => {
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
operation: 'date_histogram',
field: '@timestamp',
});
// just check the data is shown
// should visualize a date histogram chart for counter field
await lens.removeDimension('lnsXY_yDimensionPanel');

await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
operation: 'count',
Expand All @@ -547,7 +524,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('should visualize data when moving the time window around the downgrade moment', async () => {
// check after the downgrade
await lens.removeLayer();
// check before the downgrade
await lens.goToTimeRange(
moment
.utc(fromTimeForScenarios, TIME_PICKER_FORMAT)
Expand Down
17 changes: 17 additions & 0 deletions x-pack/test/functional/apps/lens/group7/config.ts
Original file line number Diff line number Diff line change
@@ -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('.')],
};
}
78 changes: 78 additions & 0 deletions x-pack/test/functional/apps/lens/group7/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* 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 7', () => {
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);

const fromTime = 'Apr 16, 2023 @ 00:00:00.000';
const toTime = 'Jun 16, 2023 @ 00:00:00.000';
await kibanaServer.uiSettings.update({
defaultIndex: indexPatternString,
'dateFormat:tz': 'UTC',
'timepicker:timeDefaults': `{ "from": "${fromTime}", "to": "${toTime}" }`,
});
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();
});

loadTestFile(require.resolve('./logsdb'));
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -41,8 +41,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const logsdbIndex = 'kibana_sample_data_logslogsdb';
const logsdbDataView = logsdbIndex;
const logsdbEsArchive = 'test/functional/fixtures/es_archiver/kibana_sample_data_logs_logsdb';
const fromTime = 'Apr 16, 2023 @ 00:00:00.000';
const toTime = 'Jun 16, 2023 @ 00:00:00.000';

before(async () => {
log.info(`loading ${logsdbIndex} index...`);
Expand All @@ -57,9 +55,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
);
log.info(`updating settings to use the "${logsdbDataView}" dataView...`);
await kibanaServer.uiSettings.update({
'dateFormat:tz': 'UTC',
defaultIndex: '0ae0bc7a-e4ca-405c-ab67-f2b5913f2a51',
'timepicker:timeDefaults': `{ "from": "${fromTime}", "to": "${toTime}" }`,
});
});

Expand Down Expand Up @@ -255,7 +251,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
field: 'utc_time',
});

// check the counter field works
// check that a basic agg on a field works
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
operation: 'min',
Expand All @@ -281,7 +277,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
field: 'utc_time',
});

// check the counter field works
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
operation: 'min',
Expand Down Expand Up @@ -318,7 +313,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
field: 'utc_time',
});

// check the counter field works
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
operation: 'min',
Expand Down Expand Up @@ -350,6 +344,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

it('should visualize correctly ES|QL queries based on a LogsDB stream', async () => {
await common.navigateToApp('discover');

await lens.goToTimeRange(
fromTimeForScenarios,
moment
.utc(toTimeForScenarios, TIME_PICKER_FORMAT)
.add(2, 'hour')
.format(TIME_PICKER_FORMAT)
);
await discover.selectTextBaseLang();
await header.waitUntilLoadingHasFinished();
await monacoEditor.setCodeEditorValue(
Expand Down Expand Up @@ -546,18 +548,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

it('should visualize correctly ES|QL queries based on a LogsDB stream', async () => {
await common.navigateToApp('discover');
await discover.selectTextBaseLang();

// Use the lens page object here also for discover: both use the same timePicker object
await lens.goToTimeRange(
fromTimeForScenarios,
moment
.utc(toTimeForScenarios, TIME_PICKER_FORMAT)
.add(2, 'hour')
.format(TIME_PICKER_FORMAT)
);
await discover.selectTextBaseLang();

await header.waitUntilLoadingHasFinished();
await monacoEditor.setCodeEditorValue(
`from ${indexes
.map(({ index }) => index)
Expand Down
Loading