Skip to content

Commit

Permalink
[Reporting/Tests] consolidate functional test configs (#52671)
Browse files Browse the repository at this point in the history
* [Reporting/Tests] consolidate functional test configs

* remove console.log

* trash

* Update

* add more to the comment

* restore historic archive for wip ui functional tests
  • Loading branch information
tsullivan authored Jan 2, 2020
1 parent 01dd08e commit 08e6ee2
Show file tree
Hide file tree
Showing 16 changed files with 67 additions and 212 deletions.
9 changes: 8 additions & 1 deletion x-pack/test/functional/page_objects/reporting_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
import { parse } from 'url';
import http from 'http';

/*
* NOTE: Reporting is a service, not an app. The page objects that are
* important for generating reports belong to the apps that integrate with the
* Reporting service. Eventually, this file should be dissolved across the
* apps that need it for testing their integration.
* Issue: https://github.com/elastic/kibana/issues/52927
*/
export function ReportingPageProvider({ getService, getPageObjects }) {
const retry = getService('retry');
const log = getService('log');
Expand All @@ -22,7 +29,7 @@ export function ReportingPageProvider({ getService, getPageObjects }) {
log.debug('ReportingPage:initTests');
await PageObjects.settings.navigateTo();
await esArchiver.loadIfNeeded('../../functional/es_archives/logstash_functional');
await esArchiver.load('historic');
await esArchiver.load('reporting/historic');
await kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
});
Expand Down
4 changes: 3 additions & 1 deletion x-pack/test/reporting/api/bwc_existing_indexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function({ getService }) {
describe('existing 6_2 index', () => {
before('load data and add index alias', async () => {
await reportingAPI.deleteAllReportingIndexes();
await esArchiver.load('bwc/6_2');
await esArchiver.load('reporting/bwc/6_2');

// The index name in the 6_2 archive.
const ARCHIVED_REPORTING_INDEX = '.reporting-2018.03.11';
Expand All @@ -37,6 +37,8 @@ export default function({ getService }) {

const stats = await usageAPI.getUsageStats();
expectedCompletedReportCount = await reportingAPI.getCompletedReportCount(stats);

await esArchiver.unload('reporting/bwc/6_2');
});

after('remove index alias', async () => {
Expand Down
8 changes: 6 additions & 2 deletions x-pack/test/reporting/api/usage.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function({ getService }) {

describe('from archive data', () => {
it('generated from 6.2', async () => {
await esArchiver.load('bwc/6_2');
await esArchiver.load('reporting/bwc/6_2');
const usage = await usageAPI.getUsageStats();

reportingAPI.expectRecentJobTypeTotalStats(usage, 'csv', 0);
Expand All @@ -64,10 +64,12 @@ export default function({ getService }) {
reportingAPI.expectAllTimePdfAppStats(usage, 'dashboard', 0);
reportingAPI.expectAllTimePdfLayoutStats(usage, 'preserve_layout', 0);
reportingAPI.expectAllTimePdfLayoutStats(usage, 'print', 0);

await esArchiver.unload('reporting/bwc/6_2');
});

it('generated from 6.3', async () => {
await esArchiver.load('bwc/6_3');
await esArchiver.load('reporting/bwc/6_3');
const usage = await usageAPI.getUsageStats();

reportingAPI.expectRecentJobTypeTotalStats(usage, 'csv', 0);
Expand All @@ -83,6 +85,8 @@ export default function({ getService }) {
reportingAPI.expectAllTimePdfAppStats(usage, 'dashboard', 3);
reportingAPI.expectAllTimePdfLayoutStats(usage, 'preserve_layout', 3);
reportingAPI.expectAllTimePdfLayoutStats(usage, 'print', 3);

await esArchiver.unload('reporting/bwc/6_3');
});
});

Expand Down
41 changes: 0 additions & 41 deletions x-pack/test/reporting/configs/api.js

This file was deleted.

30 changes: 20 additions & 10 deletions x-pack/test/reporting/configs/chromium_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,35 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { getReportingApiConfig } from './api';
import { ReportingAPIProvider } from '../services';

export default async function({ readConfigFile }) {
const reportingApiConfig = await getReportingApiConfig({ readConfigFile });
const apiConfig = await readConfigFile(require.resolve('../../api_integration/config.js'));
const functionalConfig = await readConfigFile(require.resolve('../../functional/config.js'));

return {
...reportingApiConfig,
junit: {
reportName: 'X-Pack Chromium API Reporting Tests',
},
servers: apiConfig.get('servers'),
junit: { reportName: 'X-Pack Chromium API Reporting Tests' },
testFiles: [require.resolve('../api/chromium_tests')],
services: {
...apiConfig.get('services'),
reportingAPI: ReportingAPIProvider,
},
kbnTestServer: {
...reportingApiConfig.kbnTestServer,
...apiConfig.get('kbnTestServer'),
serverArgs: [
...reportingApiConfig.kbnTestServer.serverArgs,
// Reporting API tests use functionalConfig instead of apiConfig because they needs a fully working UI. By default, the API config
// does not have optimize setting enabled, and Kibana would not have a working UI.
...functionalConfig.get('kbnTestServer.serverArgs'),
'--logging.events.log',
'["info","warning","error","fatal","optimize","reporting"]',
'--xpack.endpoint.enabled=true',
'--xpack.reporting.csv.enablePanelActionDownload=true',
`--xpack.reporting.capture.browser.type=chromium`,
`--xpack.spaces.enabled=false`,
'--xpack.security.session.idleTimeout=3600000',
'--xpack.spaces.enabled=false',
],
},
esArchiver: apiConfig.get('esArchiver'),
esTestCluster: apiConfig.get('esTestCluster'),
};
}
22 changes: 15 additions & 7 deletions x-pack/test/reporting/configs/chromium_functional.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,32 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { getFunctionalConfig } from './functional';

export default async function({ readConfigFile }) {
const functionalConfig = await getFunctionalConfig({ readConfigFile });
const functionalConfig = await readConfigFile(require.resolve('../../functional/config.js'));

return {
...functionalConfig,
services: functionalConfig.get('services'),
pageObjects: functionalConfig.get('pageObjects'),
servers: functionalConfig.get('servers'),
apps: functionalConfig.get('apps'),
screenshots: functionalConfig.get('screenshots'),
junit: {
reportName: 'X-Pack Chromium Functional Reporting Tests',
},
testFiles: [require.resolve('../functional')],
kbnTestServer: {
...functionalConfig.kbnTestServer,
...functionalConfig.get('kbnTestServer'),
serverArgs: [
...functionalConfig.kbnTestServer.serverArgs,
...functionalConfig.get('kbnTestServer.serverArgs'),
'--logging.events.log',
'["info","warning","error","fatal","optimize","reporting"]',
'--xpack.endpoint.enabled=true',
'--xpack.reporting.csv.enablePanelActionDownload=true',
`--xpack.reporting.capture.browser.type=chromium`,
'--xpack.security.session.idleTimeout=3600000',
'--xpack.spaces.enabled=false',
],
},
esArchiver: functionalConfig.get('esArchiver'),
esTestCluster: functionalConfig.get('esTestCluster'),
};
}
39 changes: 0 additions & 39 deletions x-pack/test/reporting/configs/functional.js

This file was deleted.

36 changes: 15 additions & 21 deletions x-pack/test/reporting/configs/generate_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,38 @@

import { esTestConfig, kbnTestConfig, kibanaServerTestUser } from '@kbn/test';
import { format as formatUrl } from 'url';
import { getApiIntegrationConfig } from '../../api_integration/config';
import { getReportingApiConfig } from './api';
import { ReportingAPIProvider } from '../services';

export default async function({ readConfigFile }) {
const servers = {
kibana: kbnTestConfig.getUrlParts(),
elasticsearch: esTestConfig.getUrlParts(),
};

const apiTestConfig = await getApiIntegrationConfig({ readConfigFile });
const reportingApiConfig = await getReportingApiConfig({ readConfigFile });
const xPackFunctionalTestsConfig = await readConfigFile(
require.resolve('../../functional/config.js')
);
const apiConfig = await readConfigFile(require.resolve('../../api_integration/config.js'));

return {
...reportingApiConfig,
servers: apiConfig.get('servers'),
junit: { reportName: 'X-Pack Reporting Generate API Integration Tests' },
testFiles: [require.resolve('../api/generate')],
services: {
...apiTestConfig.services,
...reportingApiConfig.services,
...apiConfig.get('services'),
reportingAPI: ReportingAPIProvider,
},
kbnTestServer: {
...xPackFunctionalTestsConfig.get('kbnTestServer'),
...apiConfig.get('kbnTestServer'),
serverArgs: [
`--optimize.enabled=false`,
'--logging.events.log',
'["info","warning","error","fatal","optimize","reporting"]',
`--elasticsearch.hosts=${formatUrl(esTestConfig.getUrlParts())}`,
`--elasticsearch.password=${kibanaServerTestUser.password}`,
`--elasticsearch.username=${kibanaServerTestUser.username}`,
`--logging.json=false`,
`--optimize.enabled=false`,
`--server.maxPayloadBytes=1679958`,
`--server.port=${kbnTestConfig.getPort()}`,
`--elasticsearch.hosts=${formatUrl(servers.elasticsearch)}`,
`--elasticsearch.username=${kibanaServerTestUser.username}`,
`--elasticsearch.password=${kibanaServerTestUser.password}`,
`--xpack.reporting.csv.enablePanelActionDownload=true`,
`--xpack.reporting.csv.maxSizeBytes=2850`,
`--xpack.reporting.queue.pollInterval=3000`,
`--xpack.spaces.enabled=false`,
],
},
esArchiver: apiTestConfig.esArchiver,
esArchiver: apiConfig.get('esArchiver'),
esTestCluster: apiConfig.get('esTestCluster'),
};
}
Binary file not shown.
90 changes: 0 additions & 90 deletions x-pack/test/reporting/es_archives/current/reporting/mappings.json

This file was deleted.

0 comments on commit 08e6ee2

Please sign in to comment.