mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
- Remove reporting-dashboard test from performance tests and add login page and home page tests to get performance metrics. - Set network latency (KBN_TEST_NETWORK_LATENCY), download throughput (KBN_TEST_DOWNLOAD_THROUGHPUT) and upload throughput (KBN_TEST_UPLOAD_THROUGHPUT) through environment variables and fallback to default 100ms latency for network latency, 5MB for download throughput and 1MB for upload throughput. Co-authored-by: Baturalp Gurdin <9674241+suchcodemuchwow@users.noreply.github.com>
This commit is contained in:
parent
0329c62b52
commit
7e3e1f8eeb
5 changed files with 84 additions and 8 deletions
34
test/functional/services/remote/network_profiles.ts
Normal file
34
test/functional/services/remote/network_profiles.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
interface NetworkOptions {
|
||||
DOWNLOAD: number;
|
||||
UPLOAD: number;
|
||||
LATENCY: number;
|
||||
}
|
||||
|
||||
const sec = 1_000;
|
||||
const kB = 1024;
|
||||
|
||||
// Download (kb/s) Upload (kb/s) Latency (ms)
|
||||
// https://gist.github.com/theodorosploumis/fd4086ee58369b68aea6b0782dc96a2e
|
||||
export const NETWORK_PROFILES: { [key: string]: NetworkOptions } = {
|
||||
DEFAULT: { DOWNLOAD: 5 * kB * sec, UPLOAD: 1 * kB * sec, LATENCY: 0.1 * sec },
|
||||
GPRS: { DOWNLOAD: 0.05 * kB * sec, UPLOAD: 0.02 * kB * sec, LATENCY: 0.5 * sec },
|
||||
MOBILE_EDGE: { DOWNLOAD: 0.24 * kB * sec, UPLOAD: 0.2 * kB * sec, LATENCY: 0.84 * sec },
|
||||
'2G_REGULAR': { DOWNLOAD: 0.25 * kB * sec, UPLOAD: 0.05 * kB * sec, LATENCY: 0.3 * sec },
|
||||
'2G_GOOD': { DOWNLOAD: 0.45 * kB * sec, UPLOAD: 0.15 * kB * sec, LATENCY: 0.15 * sec },
|
||||
'3G_SLOW': { DOWNLOAD: 0.78 * kB * sec, UPLOAD: 0.33 * kB * sec, LATENCY: 0.2 * sec },
|
||||
'3G_REGULAR': { DOWNLOAD: 0.75 * kB * sec, UPLOAD: 0.25 * kB * sec, LATENCY: 0.1 * sec },
|
||||
'3G_GOOD': { DOWNLOAD: 1.5 * kB * sec, UPLOAD: 0.75 * kB * sec, LATENCY: 0.04 * sec },
|
||||
'4G_REGULAR': { DOWNLOAD: 4 * kB * sec, UPLOAD: 3 * kB * sec, LATENCY: 0.02 * sec },
|
||||
DSL: { DOWNLOAD: 2 * kB * sec, UPLOAD: 1 * kB * sec, LATENCY: 0.005 * sec },
|
||||
CABLE_5MBPS: { DOWNLOAD: 5 * kB * sec, UPLOAD: 1 * kB * sec, LATENCY: 0.28 * sec },
|
||||
CABLE_8MBPS: { DOWNLOAD: 8 * kB * sec, UPLOAD: 2 * kB * sec, LATENCY: 0.1 * sec },
|
||||
WIFI: { DOWNLOAD: 30 * kB * sec, UPLOAD: 15 * kB * sec, LATENCY: 0.002 * sec },
|
||||
};
|
|
@ -32,6 +32,7 @@ import { createStdoutSocket } from './create_stdout_stream';
|
|||
import { preventParallelCalls } from './prevent_parallel_calls';
|
||||
|
||||
import { Browsers } from './browsers';
|
||||
import { NETWORK_PROFILES } from './network_profiles';
|
||||
|
||||
const throttleOption: string = process.env.TEST_THROTTLE_NETWORK as string;
|
||||
const headlessBrowser: string = process.env.TEST_BROWSER_HEADLESS as string;
|
||||
|
@ -290,14 +291,30 @@ async function attemptToCreateCommand(
|
|||
const { session, consoleLog$ } = await buildDriverInstance();
|
||||
|
||||
if (throttleOption === '1' && browserType === 'chrome') {
|
||||
// Only chrome supports this option.
|
||||
log.debug('NETWORK THROTTLED: 768k down, 256k up, 100ms latency.');
|
||||
const { KBN_NETWORK_TEST_PROFILE = 'DEFAULT' } = process.env;
|
||||
|
||||
(session as any).setNetworkConditions({
|
||||
const profile =
|
||||
KBN_NETWORK_TEST_PROFILE in Object.keys(NETWORK_PROFILES)
|
||||
? KBN_NETWORK_TEST_PROFILE
|
||||
: 'DEFAULT';
|
||||
|
||||
const {
|
||||
DOWNLOAD: downloadThroughput,
|
||||
UPLOAD: uploadThroughput,
|
||||
LATENCY: latency,
|
||||
} = NETWORK_PROFILES[`${profile}`];
|
||||
|
||||
// Only chrome supports this option.
|
||||
log.debug(
|
||||
`NETWORK THROTTLED with profile ${profile}: ${downloadThroughput}kbps down, ${uploadThroughput}kbps up, ${latency} ms latency.`
|
||||
);
|
||||
|
||||
// @ts-expect-error
|
||||
session.setNetworkConditions({
|
||||
offline: false,
|
||||
latency: 100, // Additional latency (ms).
|
||||
download_throughput: 768 * 1024, // These speeds are in bites per second, not kilobytes.
|
||||
upload_throughput: 256 * 1024,
|
||||
latency,
|
||||
download_throughput: downloadThroughput,
|
||||
upload_throughput: uploadThroughput,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
25
x-pack/test/performance/tests/home.ts
Normal file
25
x-pack/test/performance/tests/home.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* 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 { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const PageObjects = getPageObjects(['common', 'security']);
|
||||
const testSubjects = getService('testSubjects');
|
||||
|
||||
describe('Login', () => {
|
||||
it('login and navigate to homepage', async () => {
|
||||
await PageObjects.common.navigateToApp('login');
|
||||
|
||||
await testSubjects.existOrFail('loginSubmit', { timeout: 2000 });
|
||||
|
||||
await PageObjects.security.login();
|
||||
|
||||
await testSubjects.existOrFail('homeApp', { timeout: 2000 });
|
||||
});
|
||||
});
|
||||
}
|
|
@ -11,6 +11,6 @@ export default function ({ loadTestFile }: FtrProviderContext) {
|
|||
describe('performance', function () {
|
||||
this.tags('ciGroup8');
|
||||
|
||||
loadTestFile(require.resolve('./reporting_dashboard'));
|
||||
loadTestFile(require.resolve('./home'));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ export default function ({ getService, getPageObject }: FtrProviderContext) {
|
|||
const dashboard = getPageObject('dashboard');
|
||||
const reporting = getPageObject('reporting');
|
||||
|
||||
describe('reporting dashbaord', () => {
|
||||
describe('Reporting Dashboard', () => {
|
||||
before(async () => {
|
||||
await kibanaServer.importExport.load(
|
||||
'x-pack/test/performance/kbn_archives/reporting_dashboard'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue