mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[APM] Add e2e test for infrastructure page (#136608)
* Add e2e test for infrastructure page * update test after Beta changes
This commit is contained in:
parent
b3a38c4137
commit
2b5822e960
4 changed files with 20506 additions and 0 deletions
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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 { apm, timerange } from '@elastic/apm-synthtrace';
|
||||
|
||||
export function generateData({ from, to }: { from: number; to: number }) {
|
||||
const range = timerange(from, to);
|
||||
const serviceRunsInContainerInstance = apm
|
||||
.service('synth-go', 'production', 'go')
|
||||
.instance('instance-a');
|
||||
|
||||
const serviceInstance = apm
|
||||
.service('synth-java', 'production', 'java')
|
||||
.instance('instance-b');
|
||||
|
||||
const serviceNoInfraDataInstance = apm
|
||||
.service('synth-node', 'production', 'node')
|
||||
.instance('instance-b');
|
||||
|
||||
return range.interval('1m').generator((timestamp) => {
|
||||
return [
|
||||
serviceRunsInContainerInstance
|
||||
.transaction('GET /apple 🍎')
|
||||
.defaults({
|
||||
'container.id': 'foo',
|
||||
'host.hostname': 'bar',
|
||||
'kubernetes.pod.name': 'baz',
|
||||
})
|
||||
.timestamp(timestamp)
|
||||
.duration(1000)
|
||||
.success(),
|
||||
serviceInstance
|
||||
.transaction('GET /banana 🍌')
|
||||
.defaults({
|
||||
'host.hostname': 'bar',
|
||||
})
|
||||
.timestamp(timestamp)
|
||||
.duration(1000)
|
||||
.success(),
|
||||
serviceNoInfraDataInstance
|
||||
.transaction('GET /banana 🍌')
|
||||
.timestamp(timestamp)
|
||||
.duration(1000)
|
||||
.success(),
|
||||
];
|
||||
});
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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 url from 'url';
|
||||
import { synthtrace } from '../../../../synthtrace';
|
||||
import { checkA11y } from '../../../support/commands';
|
||||
import { generateData } from './generate_data';
|
||||
|
||||
const start = '2021-10-10T00:00:00.000Z';
|
||||
const end = '2021-10-10T00:15:00.000Z';
|
||||
|
||||
const goServiceInfraPageHref = url.format({
|
||||
pathname: '/app/apm/services/synth-go/infrastructure',
|
||||
query: { rangeFrom: start, rangeTo: end },
|
||||
});
|
||||
|
||||
const javaServiceInfraPageHref = url.format({
|
||||
pathname: '/app/apm/services/synth-java/infrastructure',
|
||||
query: { rangeFrom: start, rangeTo: end },
|
||||
});
|
||||
|
||||
const nodeServiceInfraPageHref = url.format({
|
||||
pathname: '/app/apm/services/synth-node/infrastructure',
|
||||
query: { rangeFrom: start, rangeTo: end },
|
||||
});
|
||||
|
||||
describe('Infrastructure page', () => {
|
||||
before(async () => {
|
||||
await synthtrace.index(
|
||||
generateData({
|
||||
from: new Date(start).getTime(),
|
||||
to: new Date(end).getTime(),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await synthtrace.clean();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.loginAsEditorUser();
|
||||
});
|
||||
|
||||
describe('when data is loaded', () => {
|
||||
it('has no detectable a11y violations on load', () => {
|
||||
cy.visit(goServiceInfraPageHref);
|
||||
cy.contains('Infrastructure');
|
||||
// set skipFailures to true to not fail the test when there are accessibility failures
|
||||
checkA11y({ skipFailures: true });
|
||||
});
|
||||
|
||||
describe('when container ids, pod names and host names are returned by the api call', () => {
|
||||
it('shows all tabs', () => {
|
||||
cy.visit(goServiceInfraPageHref);
|
||||
cy.contains('Containers');
|
||||
cy.contains('Pods');
|
||||
cy.contains('Hosts');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when only host names are returned by the api call', () => {
|
||||
it('shows only Hosts tab', () => {
|
||||
cy.visit(javaServiceInfraPageHref);
|
||||
cy.contains('Hosts');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when none infrastructure attributes are returned by the api call', () => {
|
||||
it('shows no data message', () => {
|
||||
cy.visit(nodeServiceInfraPageHref);
|
||||
cy.contains('No results match your search criteria.');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -48,9 +48,12 @@ export async function cypressStart(
|
|||
|
||||
const esRequestTimeout = config.get('timeouts.esRequestTimeout');
|
||||
const archiveName = 'apm_mappings_only_8.0.0';
|
||||
const metricsArchiveName = 'metrics_8.0.0';
|
||||
|
||||
console.log(`Creating APM mappings`);
|
||||
await esArchiverLoad(archiveName);
|
||||
console.log(`Creating Metrics mappings`);
|
||||
await esArchiverLoad(metricsArchiveName);
|
||||
|
||||
const spec = argv.grep as string | undefined;
|
||||
const res = await cypressExecution({
|
||||
|
@ -66,6 +69,8 @@ export async function cypressStart(
|
|||
|
||||
console.log('Removing APM mappings');
|
||||
await esArchiverUnload(archiveName);
|
||||
console.log('Removing Metrics mappings');
|
||||
await esArchiverUnload(metricsArchiveName);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue