mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
(cherry picked from commit 40fa6076b1
)
This commit is contained in:
parent
7a74d8e773
commit
3d7848f21e
9 changed files with 791 additions and 60 deletions
|
@ -47,6 +47,9 @@ export class VisualizePageObject extends FtrService {
|
||||||
LOGSTASH_NON_TIME_BASED: 'logstash*',
|
LOGSTASH_NON_TIME_BASED: 'logstash*',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
remoteEsPrefix = 'ftr-remote:';
|
||||||
|
defaultIndexString = 'logstash-*';
|
||||||
|
|
||||||
public async initTests(isNewLibrary = false) {
|
public async initTests(isNewLibrary = false) {
|
||||||
await this.kibanaServer.savedObjects.clean({ types: ['visualization'] });
|
await this.kibanaServer.savedObjects.clean({ types: ['visualization'] });
|
||||||
await this.kibanaServer.importExport.load(
|
await this.kibanaServer.importExport.load(
|
||||||
|
@ -54,7 +57,7 @@ export class VisualizePageObject extends FtrService {
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.kibanaServer.uiSettings.replace({
|
await this.kibanaServer.uiSettings.replace({
|
||||||
defaultIndex: 'logstash-*',
|
defaultIndex: this.defaultIndexString,
|
||||||
[FORMATS_UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b',
|
[FORMATS_UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b',
|
||||||
'visualization:visualize:legacyPieChartsLibrary': !isNewLibrary,
|
'visualization:visualize:legacyPieChartsLibrary': !isNewLibrary,
|
||||||
'visualization:visualize:legacyHeatmapChartsLibrary': !isNewLibrary,
|
'visualization:visualize:legacyHeatmapChartsLibrary': !isNewLibrary,
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
require('../../src/setup_node_env');
|
require('../../src/setup_node_env');
|
||||||
require('@kbn/test').runTestsCli([
|
require('@kbn/test').runTestsCli([
|
||||||
|
require.resolve('../test/functional/config.ccs.ts'),
|
||||||
require.resolve('../test/functional/config.js'),
|
require.resolve('../test/functional/config.js'),
|
||||||
require.resolve('../test/functional_basic/config.ts'),
|
require.resolve('../test/functional_basic/config.ts'),
|
||||||
require.resolve('../test/security_solution_endpoint/config.ts'),
|
require.resolve('../test/security_solution_endpoint/config.ts'),
|
||||||
|
|
|
@ -5,84 +5,119 @@
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { EsArchiver } from '@kbn/es-archiver';
|
||||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||||
|
|
||||||
export default function ({ getService, loadTestFile, getPageObjects }: FtrProviderContext) {
|
export default ({ getService, loadTestFile, getPageObjects }: FtrProviderContext) => {
|
||||||
const browser = getService('browser');
|
const browser = getService('browser');
|
||||||
const log = getService('log');
|
const log = getService('log');
|
||||||
const esArchiver = getService('esArchiver');
|
const esArchiver = getService('esArchiver');
|
||||||
const kibanaServer = getService('kibanaServer');
|
const kibanaServer = getService('kibanaServer');
|
||||||
const PageObjects = getPageObjects(['timePicker']);
|
const PageObjects = getPageObjects(['timePicker']);
|
||||||
|
const config = getService('config');
|
||||||
|
let remoteEsArchiver;
|
||||||
|
|
||||||
describe('lens app', () => {
|
describe('lens app', () => {
|
||||||
|
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 () => {
|
before(async () => {
|
||||||
log.debug('Starting lens before method');
|
await log.debug('Starting lens before method');
|
||||||
await browser.setWindowSize(1280, 1200);
|
await browser.setWindowSize(1280, 1200);
|
||||||
await esArchiver.load('x-pack/test/functional/es_archives/logstash_functional');
|
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)
|
// changing the timepicker default here saves us from having to set it in Discover (~8s)
|
||||||
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
|
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
|
||||||
await kibanaServer.uiSettings.update({ defaultIndex: 'logstash-*', 'dateFormat:tz': 'UTC' });
|
await kibanaServer.uiSettings.update({
|
||||||
await kibanaServer.importExport.load(
|
defaultIndex: indexPatternString,
|
||||||
'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json'
|
'dateFormat:tz': 'UTC',
|
||||||
);
|
});
|
||||||
await kibanaServer.importExport.load(
|
await kibanaServer.importExport.load(fixtureDirs.lensBasic);
|
||||||
'x-pack/test/functional/fixtures/kbn_archiver/lens/default'
|
await kibanaServer.importExport.load(fixtureDirs.lensDefault);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional');
|
await esArchiver.unload(esArchive);
|
||||||
await PageObjects.timePicker.resetDefaultAbsoluteRangeViaUiSettings();
|
await PageObjects.timePicker.resetDefaultAbsoluteRangeViaUiSettings();
|
||||||
await kibanaServer.importExport.unload(
|
await kibanaServer.importExport.unload(fixtureDirs.lensBasic);
|
||||||
'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json'
|
await kibanaServer.importExport.unload(fixtureDirs.lensDefault);
|
||||||
);
|
|
||||||
await kibanaServer.importExport.unload(
|
|
||||||
'x-pack/test/functional/fixtures/kbn_archiver/lens/default'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('', function () {
|
if (config.get('esTestCluster.ccs')) {
|
||||||
this.tags(['ciGroup3', 'skipFirefox']);
|
describe('', function () {
|
||||||
loadTestFile(require.resolve('./smokescreen'));
|
this.tags(['ciGroup3', 'skipFirefox']);
|
||||||
loadTestFile(require.resolve('./persistent_context'));
|
loadTestFile(require.resolve('./smokescreen'));
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
describe('', function () {
|
||||||
|
this.tags(['ciGroup3', 'skipFirefox']);
|
||||||
|
loadTestFile(require.resolve('./smokescreen'));
|
||||||
|
loadTestFile(require.resolve('./persistent_context'));
|
||||||
|
});
|
||||||
|
|
||||||
describe('', function () {
|
describe('', function () {
|
||||||
this.tags(['ciGroup16', 'skipFirefox']);
|
this.tags(['ciGroup16', 'skipFirefox']);
|
||||||
|
|
||||||
loadTestFile(require.resolve('./add_to_dashboard'));
|
loadTestFile(require.resolve('./add_to_dashboard'));
|
||||||
loadTestFile(require.resolve('./table_dashboard'));
|
loadTestFile(require.resolve('./table_dashboard'));
|
||||||
loadTestFile(require.resolve('./table'));
|
loadTestFile(require.resolve('./table'));
|
||||||
loadTestFile(require.resolve('./runtime_fields'));
|
loadTestFile(require.resolve('./runtime_fields'));
|
||||||
loadTestFile(require.resolve('./dashboard'));
|
loadTestFile(require.resolve('./dashboard'));
|
||||||
loadTestFile(require.resolve('./multi_terms'));
|
loadTestFile(require.resolve('./multi_terms'));
|
||||||
loadTestFile(require.resolve('./epoch_millis'));
|
loadTestFile(require.resolve('./epoch_millis'));
|
||||||
loadTestFile(require.resolve('./show_underlying_data'));
|
loadTestFile(require.resolve('./show_underlying_data'));
|
||||||
loadTestFile(require.resolve('./show_underlying_data_dashboard'));
|
loadTestFile(require.resolve('./show_underlying_data_dashboard'));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('', function () {
|
describe('', function () {
|
||||||
this.tags(['ciGroup4', 'skipFirefox']);
|
this.tags(['ciGroup4', 'skipFirefox']);
|
||||||
|
|
||||||
loadTestFile(require.resolve('./colors'));
|
loadTestFile(require.resolve('./colors'));
|
||||||
loadTestFile(require.resolve('./chart_data'));
|
loadTestFile(require.resolve('./chart_data'));
|
||||||
loadTestFile(require.resolve('./time_shift'));
|
loadTestFile(require.resolve('./time_shift'));
|
||||||
loadTestFile(require.resolve('./drag_and_drop'));
|
loadTestFile(require.resolve('./drag_and_drop'));
|
||||||
loadTestFile(require.resolve('./disable_auto_apply'));
|
loadTestFile(require.resolve('./disable_auto_apply'));
|
||||||
loadTestFile(require.resolve('./geo_field'));
|
loadTestFile(require.resolve('./geo_field'));
|
||||||
loadTestFile(require.resolve('./formula'));
|
loadTestFile(require.resolve('./formula'));
|
||||||
loadTestFile(require.resolve('./heatmap'));
|
loadTestFile(require.resolve('./heatmap'));
|
||||||
loadTestFile(require.resolve('./gauge'));
|
loadTestFile(require.resolve('./gauge'));
|
||||||
loadTestFile(require.resolve('./metrics'));
|
loadTestFile(require.resolve('./metrics'));
|
||||||
loadTestFile(require.resolve('./reference_lines'));
|
loadTestFile(require.resolve('./reference_lines'));
|
||||||
loadTestFile(require.resolve('./annotations'));
|
loadTestFile(require.resolve('./annotations'));
|
||||||
loadTestFile(require.resolve('./inspector'));
|
loadTestFile(require.resolve('./inspector'));
|
||||||
loadTestFile(require.resolve('./error_handling'));
|
loadTestFile(require.resolve('./error_handling'));
|
||||||
loadTestFile(require.resolve('./lens_tagging'));
|
loadTestFile(require.resolve('./lens_tagging'));
|
||||||
loadTestFile(require.resolve('./lens_reporting'));
|
loadTestFile(require.resolve('./lens_reporting'));
|
||||||
loadTestFile(require.resolve('./tsvb_open_in_lens'));
|
loadTestFile(require.resolve('./tsvb_open_in_lens'));
|
||||||
// has to be last one in the suite because it overrides saved objects
|
// has to be last one in the suite because it overrides saved objects
|
||||||
loadTestFile(require.resolve('./rollup'));
|
loadTestFile(require.resolve('./rollup'));
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
|
@ -17,6 +17,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||||
const elasticChart = getService('elasticChart');
|
const elasticChart = getService('elasticChart');
|
||||||
const filterBar = getService('filterBar');
|
const filterBar = getService('filterBar');
|
||||||
const retry = getService('retry');
|
const retry = getService('retry');
|
||||||
|
const config = getService('config');
|
||||||
|
|
||||||
describe('lens smokescreen tests', () => {
|
describe('lens smokescreen tests', () => {
|
||||||
it('should allow creation of lens xy chart', async () => {
|
it('should allow creation of lens xy chart', async () => {
|
||||||
|
@ -686,8 +687,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow to change index pattern', async () => {
|
it('should allow to change index pattern', async () => {
|
||||||
await PageObjects.lens.switchFirstLayerIndexPattern('log*');
|
let indexPatternString;
|
||||||
expect(await PageObjects.lens.getFirstLayerIndexPattern()).to.equal('log*');
|
if (config.get('esTestCluster.ccs')) {
|
||||||
|
indexPatternString = 'ftr-remote:log*';
|
||||||
|
} else {
|
||||||
|
indexPatternString = 'log*';
|
||||||
|
}
|
||||||
|
await PageObjects.lens.switchFirstLayerIndexPattern(indexPatternString);
|
||||||
|
expect(await PageObjects.lens.getFirstLayerIndexPattern()).to.equal(indexPatternString);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show a download button only when the configuration is valid', async () => {
|
it('should show a download button only when the configuration is valid', async () => {
|
||||||
|
|
54
x-pack/test/functional/config.ccs.ts
Normal file
54
x-pack/test/functional/config.ccs.ts
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* 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';
|
||||||
|
import { RemoteEsArchiverProvider } from './services/remote_es/remote_es_archiver';
|
||||||
|
import { RemoteEsProvider } from './services/remote_es/remote_es';
|
||||||
|
|
||||||
|
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
||||||
|
const functionalConfig = await readConfigFile(require.resolve('./config'));
|
||||||
|
|
||||||
|
return {
|
||||||
|
...functionalConfig.getAll(),
|
||||||
|
|
||||||
|
testFiles: [require.resolve('./apps/lens')],
|
||||||
|
|
||||||
|
junit: {
|
||||||
|
reportName: 'X-Pack CCS Tests',
|
||||||
|
},
|
||||||
|
|
||||||
|
security: {
|
||||||
|
...functionalConfig.get('security'),
|
||||||
|
remoteEsRoles: {
|
||||||
|
ccs_remote_search: {
|
||||||
|
indices: [
|
||||||
|
{
|
||||||
|
names: ['*'],
|
||||||
|
privileges: ['read', 'view_index_metadata', 'read_cross_cluster'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultRoles: [...(functionalConfig.get('security.defaultRoles') ?? []), 'ccs_remote_search'],
|
||||||
|
},
|
||||||
|
|
||||||
|
esTestCluster: {
|
||||||
|
...functionalConfig.get('esTestCluster'),
|
||||||
|
ccs: {
|
||||||
|
remoteClusterUrl:
|
||||||
|
process.env.REMOTE_CLUSTER_URL ??
|
||||||
|
'http://elastic:changeme@localhost:' +
|
||||||
|
`${functionalConfig.get('servers.elasticsearch.port') + 1}`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
services: {
|
||||||
|
...functionalConfig.get('services'),
|
||||||
|
remoteEs: RemoteEsProvider,
|
||||||
|
remoteEsArchiver: RemoteEsArchiverProvider,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
23
x-pack/test/functional/services/remote_es/remote_es.ts
Normal file
23
x-pack/test/functional/services/remote_es/remote_es.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* 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 { Client } from '@elastic/elasticsearch';
|
||||||
|
|
||||||
|
import { systemIndicesSuperuser, createRemoteEsClientForFtrConfig } from '@kbn/test';
|
||||||
|
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kibana-specific @elastic/elasticsearch client instance.
|
||||||
|
*/
|
||||||
|
export function RemoteEsProvider({ getService }: FtrProviderContext): Client {
|
||||||
|
const config = getService('config');
|
||||||
|
|
||||||
|
return createRemoteEsClientForFtrConfig(config, {
|
||||||
|
// Use system indices user so tests can write to system indices
|
||||||
|
authOverride: systemIndicesSuperuser,
|
||||||
|
});
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* 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 function RemoteEsArchiverProvider({ getService }: FtrProviderContext): EsArchiver {
|
||||||
|
const remoteEs = getService('remoteEs' as 'es');
|
||||||
|
const log = getService('log');
|
||||||
|
const kibanaServer = getService('kibanaServer');
|
||||||
|
|
||||||
|
return new EsArchiver({
|
||||||
|
client: remoteEs,
|
||||||
|
log,
|
||||||
|
kbnClient: kibanaServer,
|
||||||
|
});
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue