diff --git a/x-pack/test/reporting/es_archives/bwc/6_2/data.json.gz b/x-pack/test/functional/es_archives/reporting/bwc/6_2/data.json.gz similarity index 100% rename from x-pack/test/reporting/es_archives/bwc/6_2/data.json.gz rename to x-pack/test/functional/es_archives/reporting/bwc/6_2/data.json.gz diff --git a/x-pack/test/reporting/es_archives/bwc/6_2/mappings.json b/x-pack/test/functional/es_archives/reporting/bwc/6_2/mappings.json similarity index 100% rename from x-pack/test/reporting/es_archives/bwc/6_2/mappings.json rename to x-pack/test/functional/es_archives/reporting/bwc/6_2/mappings.json diff --git a/x-pack/test/reporting/es_archives/bwc/6_3/data.json.gz b/x-pack/test/functional/es_archives/reporting/bwc/6_3/data.json.gz similarity index 100% rename from x-pack/test/reporting/es_archives/bwc/6_3/data.json.gz rename to x-pack/test/functional/es_archives/reporting/bwc/6_3/data.json.gz diff --git a/x-pack/test/reporting/es_archives/bwc/6_3/mappings.json b/x-pack/test/functional/es_archives/reporting/bwc/6_3/mappings.json similarity index 100% rename from x-pack/test/reporting/es_archives/bwc/6_3/mappings.json rename to x-pack/test/functional/es_archives/reporting/bwc/6_3/mappings.json diff --git a/x-pack/test/reporting/es_archives/historic/data.json.gz b/x-pack/test/functional/es_archives/reporting/historic/data.json.gz similarity index 100% rename from x-pack/test/reporting/es_archives/historic/data.json.gz rename to x-pack/test/functional/es_archives/reporting/historic/data.json.gz diff --git a/x-pack/test/reporting/es_archives/historic/mappings.json b/x-pack/test/functional/es_archives/reporting/historic/mappings.json similarity index 100% rename from x-pack/test/reporting/es_archives/historic/mappings.json rename to x-pack/test/functional/es_archives/reporting/historic/mappings.json diff --git a/x-pack/test/functional/page_objects/reporting_page.js b/x-pack/test/functional/page_objects/reporting_page.js index d28234803ca29c..acbc1dd100e5d6 100644 --- a/x-pack/test/functional/page_objects/reporting_page.js +++ b/x-pack/test/functional/page_objects/reporting_page.js @@ -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'); @@ -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-*', }); diff --git a/x-pack/test/reporting/api/bwc_existing_indexes.js b/x-pack/test/reporting/api/bwc_existing_indexes.js index da2ed87159209b..ffcf123848bb2e 100644 --- a/x-pack/test/reporting/api/bwc_existing_indexes.js +++ b/x-pack/test/reporting/api/bwc_existing_indexes.js @@ -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'; @@ -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 () => { diff --git a/x-pack/test/reporting/api/usage.js b/x-pack/test/reporting/api/usage.js index c5271255d483b6..c1005c441f4639 100644 --- a/x-pack/test/reporting/api/usage.js +++ b/x-pack/test/reporting/api/usage.js @@ -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); @@ -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); @@ -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'); }); }); diff --git a/x-pack/test/reporting/configs/api.js b/x-pack/test/reporting/configs/api.js deleted file mode 100644 index 523bd551f9ab6c..00000000000000 --- a/x-pack/test/reporting/configs/api.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -const path = require('path'); - -import { ReportingAPIProvider } from '../services'; - -export async function getReportingApiConfig({ readConfigFile }) { - const apiConfig = await readConfigFile(require.resolve('../../api_integration/config.js')); - - return { - servers: apiConfig.get('servers'), - services: { - ...apiConfig.get('services'), - reportingAPI: ReportingAPIProvider, - }, - esArchiver: { - directory: path.resolve(__dirname, '../es_archives'), - }, - junit: { - reportName: 'X-Pack Reporting API Tests', - }, - testFiles: [require.resolve('../api/generate')], - esTestCluster: apiConfig.get('esTestCluster'), - kbnTestServer: { - ...apiConfig.get('kbnTestServer'), - serverArgs: [ - ...apiConfig.get('kbnTestServer.serverArgs'), - '--xpack.reporting.csv.enablePanelActionDownload=true', - `--optimize.enabled=true`, - '--logging.events.log', - JSON.stringify(['info', 'warning', 'error', 'fatal', 'optimize', 'reporting']), - ], - }, - }; -} - -export default getReportingApiConfig; diff --git a/x-pack/test/reporting/configs/chromium_api.js b/x-pack/test/reporting/configs/chromium_api.js index feaabefcd7dfbe..f016738c0e052d 100644 --- a/x-pack/test/reporting/configs/chromium_api.js +++ b/x-pack/test/reporting/configs/chromium_api.js @@ -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'), }; } diff --git a/x-pack/test/reporting/configs/chromium_functional.js b/x-pack/test/reporting/configs/chromium_functional.js index 5cb14f048aeafd..22640e858cc6cf 100644 --- a/x-pack/test/reporting/configs/chromium_functional.js +++ b/x-pack/test/reporting/configs/chromium_functional.js @@ -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'), }; } diff --git a/x-pack/test/reporting/configs/functional.js b/x-pack/test/reporting/configs/functional.js deleted file mode 100644 index 33481a1cab3303..00000000000000 --- a/x-pack/test/reporting/configs/functional.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -const path = require('path'); - -export async function getFunctionalConfig({ readConfigFile }) { - const xPackFunctionalTestsConfig = await readConfigFile( - require.resolve('../../functional/config.js') - ); - - return { - services: xPackFunctionalTestsConfig.get('services'), - pageObjects: xPackFunctionalTestsConfig.get('pageObjects'), - servers: xPackFunctionalTestsConfig.get('servers'), - esTestCluster: xPackFunctionalTestsConfig.get('esTestCluster'), - apps: xPackFunctionalTestsConfig.get('apps'), - esArchiver: { - directory: path.resolve(__dirname, '../es_archives'), - }, - screenshots: xPackFunctionalTestsConfig.get('screenshots'), - junit: { - reportName: 'X-Pack Reporting Functional Tests', - }, - kbnTestServer: { - ...xPackFunctionalTestsConfig.get('kbnTestServer'), - serverArgs: [ - ...xPackFunctionalTestsConfig.get('kbnTestServer.serverArgs'), - '--xpack.reporting.csv.enablePanelActionDownload=true', - '--logging.events.log', - JSON.stringify(['info', 'warning', 'error', 'fatal', 'optimize', 'reporting']), - ], - }, - testFiles: [require.resolve('../functional')], - }; -} - -export default getFunctionalConfig; diff --git a/x-pack/test/reporting/configs/generate_api.js b/x-pack/test/reporting/configs/generate_api.js index de63d1e3b6715b..c2b5e6c84f05fe 100644 --- a/x-pack/test/reporting/configs/generate_api.js +++ b/x-pack/test/reporting/configs/generate_api.js @@ -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'), }; } diff --git a/x-pack/test/reporting/es_archives/current/reporting/data.json.gz b/x-pack/test/reporting/es_archives/current/reporting/data.json.gz deleted file mode 100644 index 9e6f6048ebc42d..00000000000000 Binary files a/x-pack/test/reporting/es_archives/current/reporting/data.json.gz and /dev/null differ diff --git a/x-pack/test/reporting/es_archives/current/reporting/mappings.json b/x-pack/test/reporting/es_archives/current/reporting/mappings.json deleted file mode 100644 index e41a524d716a6d..00000000000000 --- a/x-pack/test/reporting/es_archives/current/reporting/mappings.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "type": "index", - "value": { - "index": ".reporting-2018.05.06", - "mappings": { - "properties": { - "attempts": { - "type": "short" - }, - "completed_at": { - "type": "date" - }, - "created_at": { - "type": "date" - }, - "created_by": { - "type": "keyword" - }, - "jobtype": { - "type": "keyword" - }, - "max_attempts": { - "type": "short" - }, - "meta": { - "properties": { - "layout": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "objectType": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "output": { - "properties": { - "content": { - "enabled": false, - "type": "object" - }, - "content_type": { - "type": "keyword" - }, - "max_size_reached": { - "type": "boolean" - } - } - }, - "payload": { - "enabled": false, - "type": "object" - }, - "priority": { - "type": "byte" - }, - "process_expiration": { - "type": "date" - }, - "started_at": { - "type": "date" - }, - "status": { - "type": "keyword" - }, - "timeout": { - "type": "long" - } - } - }, - "settings": { - "index": { - "auto_expand_replicas": "0-1", - "number_of_replicas": "0", - "number_of_shards": "1" - } - } - } -} \ No newline at end of file