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

Performance tests journey based configs #132119

Merged
merged 18 commits into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c3c032a
restructure performance tests for per journey config
May 10, 2022
01c5d51
allow default exports for performance folder
May 11, 2022
8c901a9
restructure performance tests for per journey config
May 12, 2022
866bc87
Merge branch 'main' of github.com:elastic/kibana into 12-05-2022-perf…
May 12, 2022
90f606c
consistent function naming
May 12, 2022
b709626
Merge branch 'main' into 12-05-2022-performance-tests-journey-based-c…
kibanamachine May 17, 2022
8725161
Merge branch 'main' of github.com:elastic/kibana into 12-05-2022-perf…
May 17, 2022
ed3451b
Merge branch 'main' of github.com:elastic/kibana into 12-05-2022-perf…
May 17, 2022
0f6c0f0
add cleanup hook to performance service for browser instance cleanup
May 17, 2022
c56beca
Merge branch '12-05-2022-performance-tests-journey-based-configs' of …
May 17, 2022
d0ec091
Merge branch 'main' into 12-05-2022-performance-tests-journey-based-c…
kibanamachine May 17, 2022
341e0fb
Merge branch 'main' into 12-05-2022-performance-tests-journey-based-c…
May 18, 2022
f3980f6
Merge branch 'main' into 12-05-2022-performance-tests-journey-based-c…
kibanamachine May 23, 2022
549ea4e
Merge branch 'main' into 12-05-2022-performance-tests-journey-based-c…
kibanamachine May 24, 2022
705404f
Merge branch 'main' of github.com:elastic/kibana into pr/132119
May 31, 2022
e6948c1
only enable APM in performance configs when TEST_PERFORMANCE_PHASE is…
May 31, 2022
5b33f41
Merge branch 'main' into 12-05-2022-performance-tests-journey-based-c…
kibanamachine Jun 3, 2022
cff018b
Merge branch 'main' into 12-05-2022-performance-tests-journey-based-c…
kibanamachine Jun 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,9 @@ enabled:
- x-pack/test/ui_capabilities/spaces_only/config.ts
- x-pack/test/upgrade_assistant_integration/config.js
- x-pack/test/usage_collection/config.ts
- x-pack/test/performance/journeys/ecommerce_dashboard/config.ts
- x-pack/test/performance/journeys/flight_dashboard/config.ts
- x-pack/test/performance/journeys/login/config.ts
- x-pack/test/performance/journeys/many_fields_discover/config.ts
- x-pack/test/performance/journeys/promotion_tracking_dashboard/config.ts
- x-pack/test/performance/journeys/web_logs_dashboard/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ for i in "${journeys[@]}"; do

checks-reporter-with-killswitch "Run Performance Tests with Playwright Config (Journey:${i},Phase: WARMUP)" \
node scripts/functional_tests \
--config x-pack/test/performance/config.playwright.ts \
--include "x-pack/test/performance/tests/playwright/${i}.ts" \
--config "x-pack/test/performance/journeys/${i}/config.ts" \
--kibana-install-dir "$KIBANA_BUILD_LOCATION" \
--debug \
--bail
Expand All @@ -40,8 +39,7 @@ for i in "${journeys[@]}"; do

checks-reporter-with-killswitch "Run Performance Tests with Playwright Config (Journey:${i},Phase: TEST)" \
node scripts/functional_tests \
--config x-pack/test/performance/config.playwright.ts \
--include "x-pack/test/performance/tests/playwright/${i}.ts" \
--config "x-pack/test/performance/journeys/${i}/config.ts" \
--kibana-install-dir "$KIBANA_BUILD_LOCATION" \
--debug \
--bail
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ module.exports = {
'x-pack/test/*/*config.*ts',
'x-pack/test/saved_object_api_integration/*/apis/**/*',
'x-pack/test/ui_capabilities/*/tests/**/*',
'x-pack/test/performance/**/*.ts',
],
rules: {
'import/no-default-export': 'off',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@
import uuid from 'uuid';
import { FtrConfigProviderContext } from '@kbn/test';

import { services } from './services';
import { pageObjects } from './page_objects';
import { services } from '../services';
import { pageObjects } from '../page_objects';

// These "secret" values are intentionally written in the source. We would make the APM server accept anonymous traffic if we could
const APM_SERVER_URL = 'https://kibana-ops-e2e-perf.apm.us-central1.gcp.cloud.es.io:443';
const APM_PUBLIC_TOKEN = 'CTs9y3cvcfq13bQqsB';

export default async function ({ readConfigFile, log }: FtrConfigProviderContext) {
const functionalConfig = await readConfigFile(require.resolve('../functional/config.base.js'));

const testFiles = [require.resolve('./tests/playwright')];
const functionalConfig = await readConfigFile(require.resolve('../../functional/config.base.js'));

const testBuildId = process.env.BUILDKITE_BUILD_ID ?? `local-${uuid()}`;
const testJobId = process.env.BUILDKITE_JOB_ID ?? `local-${uuid()}`;
Expand All @@ -26,7 +24,6 @@ export default async function ({ readConfigFile, log }: FtrConfigProviderContext
log.info(` 👷‍♀️ BUILD ID ${testBuildId}\n 👷 JOB ID ${testJobId}\n 👷‍♂️ EXECUTION ID:${executionId}`);

return {
testFiles,
services,
pageObjects,
servicesRequiredForTestAnalysis: ['performance'],
Expand Down Expand Up @@ -58,15 +55,10 @@ export default async function ({ readConfigFile, log }: FtrConfigProviderContext
// for a body with larger size, we might need to reconfigure the APM server to increase the limit.
// https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html#long-field-max-length
ELASTIC_APM_LONG_FIELD_MAX_LENGTH: 300_000,
ELASTIC_APM_GLOBAL_LABELS: Object.entries({
ftrConfig: `x-pack/test/performance/tests/config.playwright`,
performancePhase: process.env.TEST_PERFORMANCE_PHASE,
journeyName: process.env.JOURNEY_NAME,
ELASTIC_APM_GLOBAL_LABELS: {
testJobId,
testBuildId,
})
.filter(([, v]) => !!v)
.reduce((acc, [k, v]) => (acc ? `${acc},${k}=${v}` : `${k}=${v}`), ''),
},
},
// delay shutdown by 15 seconds to ensure that APM can report the data it collects during test execution
delayShutdown: 15_000,
Expand Down
37 changes: 37 additions & 0 deletions x-pack/test/performance/journeys/ecommerce_dashboard/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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 { serializeApmGlobalLabels } from '../../utils';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const performanceConfig = await readConfigFile(require.resolve('../base.config'));

const testFiles = [require.resolve('./ecommerce_dashboard')];

const config = {
testFiles,
...performanceConfig.getAll(),
};

const apmGlobalLabels = {
...performanceConfig.get('kbnTestServer').env.ELASTIC_APM_GLOBAL_LABELS,
ftrConfig: `x-pack/test/performance/tests/journeys/ecommerce_dashboard/config.ts`,
performancePhase: process.env.TEST_PERFORMANCE_PHASE,
journeyName: 'ecommerce_dashboard',
};

return {
...config,
kbnTestServer: {
...config.kbnTestServer,
env: {
...config.kbnTestServer.env,
ELASTIC_APM_GLOBAL_LABELS: serializeApmGlobalLabels(apmGlobalLabels),
},
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Page } from 'playwright';
import { FtrProviderContext } from '../../ftr_provider_context';
import { StepCtx } from '../../services/performance';

export default function ecommerceDashboard({ getService }: FtrProviderContext) {
export default function ({ getService }: FtrProviderContext) {
describe('ecommerce_dashboard', () => {
it('ecommerce_dashboard', async () => {
const performance = getService('performance');
Expand Down
37 changes: 37 additions & 0 deletions x-pack/test/performance/journeys/flight_dashboard/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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 { serializeApmGlobalLabels } from '../../utils';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const performanceConfig = await readConfigFile(require.resolve('../base.config'));

const testFiles = [require.resolve('./flight_dashboard')];

const config = {
testFiles,
...performanceConfig.getAll(),
};

const apmGlobalLabels = {
...performanceConfig.get('kbnTestServer').env.ELASTIC_APM_GLOBAL_LABELS,
ftrConfig: `x-pack/test/performance/tests/journeys/flight_dashboard/config.ts`,
performancePhase: process.env.TEST_PERFORMANCE_PHASE,
journeyName: 'flight_dashboard',
};

return {
...config,
kbnTestServer: {
...config.kbnTestServer,
env: {
...config.kbnTestServer.env,
ELASTIC_APM_GLOBAL_LABELS: serializeApmGlobalLabels(apmGlobalLabels),
},
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { FtrProviderContext } from '../../ftr_provider_context';
import { StepCtx } from '../../services/performance';

export default function flightDashboard({ getService }: FtrProviderContext) {
export default function ({ getService }: FtrProviderContext) {
describe('flight_dashboard', () => {
it('flight_dashboard', async () => {
const performance = getService('performance');
Expand Down
37 changes: 37 additions & 0 deletions x-pack/test/performance/journeys/login/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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 { serializeApmGlobalLabels } from '../../utils';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const performanceConfig = await readConfigFile(require.resolve('../base.config'));

const testFiles = [require.resolve('./login')];

const config = {
testFiles,
...performanceConfig.getAll(),
};

const apmGlobalLabels = {
...performanceConfig.get('kbnTestServer').env.ELASTIC_APM_GLOBAL_LABELS,
ftrConfig: `x-pack/test/performance/tests/journeys/login/config.ts`,
performancePhase: process.env.TEST_PERFORMANCE_PHASE,
journeyName: 'login',
};

return {
...config,
kbnTestServer: {
...config.kbnTestServer,
env: {
...config.kbnTestServer.env,
ELASTIC_APM_GLOBAL_LABELS: serializeApmGlobalLabels(apmGlobalLabels),
},
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { FtrProviderContext } from '../../ftr_provider_context';
import { StepCtx } from '../../services/performance';

export default function ecommerceDashboard({ getService }: FtrProviderContext) {
export default function ({ getService }: FtrProviderContext) {
describe('login', () => {
it('login', async () => {
const inputDelays = getService('inputDelays');
Expand Down
37 changes: 37 additions & 0 deletions x-pack/test/performance/journeys/many_fields_discover/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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 { serializeApmGlobalLabels } from '../../utils';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const performanceConfig = await readConfigFile(require.resolve('../base.config'));

const testFiles = [require.resolve('./many_fields_discover')];

const config = {
testFiles,
...performanceConfig.getAll(),
};

const apmGlobalLabels = {
...performanceConfig.get('kbnTestServer').env.ELASTIC_APM_GLOBAL_LABELS,
ftrConfig: `x-pack/test/performance/tests/journeys/many_fields_discover/config.ts`,
performancePhase: process.env.TEST_PERFORMANCE_PHASE,
journeyName: 'many_fields_discover',
};

return {
...config,
kbnTestServer: {
...config.kbnTestServer,
env: {
...config.kbnTestServer.env,
ELASTIC_APM_GLOBAL_LABELS: serializeApmGlobalLabels(apmGlobalLabels),
},
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { FtrProviderContext } from '../../ftr_provider_context';
import { StepCtx } from '../../services/performance';

export default function manyFieldsDiscover({ getService }: FtrProviderContext) {
export default function ({ getService }: FtrProviderContext) {
// FAILING: https://github.com/elastic/kibana/issues/130287
describe.skip('many_fields_discover', () => {
const performance = getService('performance');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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 { serializeApmGlobalLabels } from '../../utils';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const performanceConfig = await readConfigFile(require.resolve('../base.config'));

const testFiles = [require.resolve('./promotion_tracking_dashboard')];

const config = {
testFiles,
...performanceConfig.getAll(),
};

const apmGlobalLabels = {
...performanceConfig.get('kbnTestServer').env.ELASTIC_APM_GLOBAL_LABELS,
ftrConfig: `x-pack/test/performance/tests/journeys/promotion_tracking_dashboard/config.ts`,
performancePhase: process.env.TEST_PERFORMANCE_PHASE,
journeyName: 'promotion_tracking_dashboard',
};

return {
...config,
kbnTestServer: {
...config.kbnTestServer,
env: {
...config.kbnTestServer.env,
ELASTIC_APM_GLOBAL_LABELS: serializeApmGlobalLabels(apmGlobalLabels),
},
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { FtrProviderContext } from '../../ftr_provider_context';
import { StepCtx } from '../../services/performance';

export default function promotionTrackingDashboard({ getService }: FtrProviderContext) {
export default function ({ getService }: FtrProviderContext) {
describe('promotion_tracking_dashboard', () => {
const performance = getService('performance');
const esArchiver = getService('esArchiver');
Expand Down
37 changes: 37 additions & 0 deletions x-pack/test/performance/journeys/web_logs_dashboard/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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 { serializeApmGlobalLabels } from '../../utils';

export default async function webLogsDashboard({ readConfigFile, log }: FtrConfigProviderContext) {
const performanceConfig = await readConfigFile(require.resolve('../base.config'));

const testFiles = [require.resolve('./web_logs_dashboard')];

const config = {
testFiles,
...performanceConfig.getAll(),
};

const apmGlobalLabels = {
...performanceConfig.get('kbnTestServer').env.ELASTIC_APM_GLOBAL_LABELS,
ftrConfig: `x-pack/test/performance/tests/journeys/web_logs_dashboard/config.ts`,
performancePhase: process.env.TEST_PERFORMANCE_PHASE,
journeyName: 'web_logs_dashboard',
};

return {
...config,
kbnTestServer: {
...config.kbnTestServer,
env: {
...config.kbnTestServer.env,
ELASTIC_APM_GLOBAL_LABELS: serializeApmGlobalLabels(apmGlobalLabels),
},
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { FtrProviderContext } from '../../ftr_provider_context';
import { StepCtx } from '../../services/performance';

export default function weblogDashboard({ getService }: FtrProviderContext) {
export default function ({ getService }: FtrProviderContext) {
describe('weblogs_dashboard', () => {
it('weblogs_dashboard', async () => {
const performance = getService('performance');
Expand Down
6 changes: 5 additions & 1 deletion x-pack/test/performance/services/performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export class PerformanceTestingService extends FtrService {

constructor(ctx: FtrProviderContext) {
super(ctx);

ctx.getService('lifecycle').cleanup.add(async () => {
await this.shutdownBrowser();
});
}

private getKibanaUrl() {
Expand Down Expand Up @@ -173,7 +177,7 @@ export class PerformanceTestingService extends FtrService {
}
}

public async shutdownBrowser() {
private async shutdownBrowser() {
if (this.browser) {
await (await this.getBrowserInstance()).close();
}
Expand Down
Loading