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

[APM] Testing error rate API and restructuring folders #72257

Merged
merged 8 commits into from
Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 23 additions & 13 deletions x-pack/test/apm_api_integration/basic/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,32 @@ export default function apmApiIntegrationTests({ loadTestFile }: FtrProviderCont
describe('APM specs (basic)', function () {
this.tags('ciGroup1');

loadTestFile(require.resolve('./annotations'));
loadTestFile(require.resolve('./feature_controls'));
loadTestFile(require.resolve('./agent_configuration'));
loadTestFile(require.resolve('./custom_link'));
loadTestFile(require.resolve('./service_maps'));

// traces
loadTestFile(require.resolve('./traces/top_traces'));
describe('Service Maps', function () {
loadTestFile(require.resolve('./service_maps/service_maps'));
});

// services
loadTestFile(require.resolve('./services/top_services'));
describe('Services', function () {
loadTestFile(require.resolve('./services/annotations'));
loadTestFile(require.resolve('./services/top_services'));
loadTestFile(require.resolve('./services/agent_name'));
loadTestFile(require.resolve('./services/transaction_types'));
});
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved

// services/transaction
loadTestFile(require.resolve('./services/transactions/top_transaction_groups'));
loadTestFile(require.resolve('./services/transactions/transaction_charts'));
loadTestFile(require.resolve('./services/transactions/agent_name'));
loadTestFile(require.resolve('./services/transactions/transaction_types'));
describe('Settings', function () {
loadTestFile(require.resolve('./settings/custom_link'));
loadTestFile(require.resolve('./settings/agent_configuration'));
});

describe('Traces', function () {
loadTestFile(require.resolve('./traces/top_traces'));
});

describe('Transaction Group', function () {
loadTestFile(require.resolve('./transaction_groups/top_transaction_groups'));
loadTestFile(require.resolve('./transaction_groups/transaction_charts'));
loadTestFile(require.resolve('./transaction_groups/error_rate'));
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { FtrProviderContext } from '../../../common/ftr_provider_context';

export default function serviceMapsApiTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../../../common/ftr_provider_context';
import { FtrProviderContext } from '../../../../common/ftr_provider_context';

export default function ApiTest({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import expect from '@kbn/expect';
import { JsonObject } from 'src/plugins/kibana_utils/common';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { FtrProviderContext } from '../../../common/ftr_provider_context';

export default function annotationApiTests({ getService }: FtrProviderContext) {
const supertestWrite = getService('supertestAsApmAnnotationsWriteUser');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../../../common/ftr_provider_context';
import { FtrProviderContext } from '../../../../common/ftr_provider_context';

export default function ApiTest({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import expect from '@kbn/expect';
import { omit, orderBy } from 'lodash';
import { AgentConfigurationIntake } from '../../../../plugins/apm/common/agent_configuration/configuration_types';
import { AgentConfigSearchParams } from '../../../../plugins/apm/server/routes/settings/agent_configuration';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { AgentConfigurationIntake } from '../../../../../plugins/apm/common/agent_configuration/configuration_types';
import { AgentConfigSearchParams } from '../../../../../plugins/apm/server/routes/settings/agent_configuration';
import { FtrProviderContext } from '../../../common/ftr_provider_context';

export default function agentConfigurationTests({ getService }: FtrProviderContext) {
const supertestRead = getService('supertestAsApmReadUser');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
import URL from 'url';
import expect from '@kbn/expect';
import { CustomLink } from '../../../../plugins/apm/common/custom_link/custom_link_types';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { CustomLink } from '../../../../../plugins/apm/common/custom_link/custom_link_types';
import { FtrProviderContext } from '../../../common/ftr_provider_context';

export default function customLinksTests({ getService }: FtrProviderContext) {
const supertestRead = getService('supertestAsApmReadUser');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../../common/ftr_provider_context';
import expectTopTraces from './top_traces.expectation.json';
import expectTopTraces from './expectation/top_traces.expectation.json';

export default function ApiTest({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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.
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../common/ftr_provider_context';
import expectedErrorRate from './expectation/error_rate.json';

export default function ApiTest({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');

// url parameters
const start = encodeURIComponent('2020-06-29T06:45:00.000Z');
const end = encodeURIComponent('2020-06-29T06:49:00.000Z');
const uiFilters = encodeURIComponent(JSON.stringify({}));

describe('Error rate', () => {
describe('when data is not loaded', () => {
it('handles the empty state', async () => {
const response = await supertest.get(
`/api/apm/services/opbeans-node/transaction_groups/error_rate?start=${start}&end=${end}&uiFilters=${uiFilters}`
);
expect(response.status).to.be(200);
expect(response.body).to.eql({
noHits: true,
erroneousTransactionsRate: [],
average: null,
});
});
});
describe('when data is loaded', () => {
before(() => esArchiver.load('8.0.0'));
after(() => esArchiver.unload('8.0.0'));

it('returns the transaction error rate', async () => {
const response = await supertest.get(
`/api/apm/services/opbeans-node/transaction_groups/error_rate?start=${start}&end=${end}&uiFilters=${uiFilters}`
);

expect(response.status).to.be(200);
expect(response.body).to.eql(expectedErrorRate);
});
});
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"noHits":false,
"erroneousTransactionsRate":[
{
"x":1593413100000,
"y":null
},
{
"x":1593413130000,
"y":null
},
{
"x":1593413160000,
"y":null
},
{
"x":1593413190000,
"y":null
},
{
"x":1593413220000,
"y":null
},
{
"x":1593413250000,
"y":0
},
{
"x":1593413280000,
"y":0.14102564102564102
},
{
"x":1593413310000,
"y":0.14634146341463414
},
{
"x":1593413340000,
"y":null
}
],
"average":0.09578903481342504
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../../../common/ftr_provider_context';
import expectedTransactionGroups from './expectations/top_transaction_groups.json';
import { FtrProviderContext } from '../../../../common/ftr_provider_context';
import expectedTransactionGroups from './expectation/top_transaction_groups.json';

export default function ApiTest({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../../../common/ftr_provider_context';
import expectedTransactionCharts from './expectations/transaction_charts.json';
import { FtrProviderContext } from '../../../../common/ftr_provider_context';
import expectedTransactionCharts from './expectation/transaction_charts.json';

export default function ApiTest({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
Expand Down
12 changes: 9 additions & 3 deletions x-pack/test/apm_api_integration/trial/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ import { FtrProviderContext } from '../../../api_integration/ftr_provider_contex
export default function observabilityApiIntegrationTests({ loadTestFile }: FtrProviderContext) {
describe('APM specs (trial)', function () {
this.tags('ciGroup1');
loadTestFile(require.resolve('./annotations'));
loadTestFile(require.resolve('./service_maps'));
loadTestFile(require.resolve('./rum_services'));

describe('Services', function () {
loadTestFile(require.resolve('./services/annotations'));
loadTestFile(require.resolve('./services/rum_services.ts'));
});

describe('Service Maps', function () {
loadTestFile(require.resolve('./service_maps/service_maps'));
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import querystring from 'querystring';
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { FtrProviderContext } from '../../../common/ftr_provider_context';

export default function serviceMapsApiTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import expect from '@kbn/expect';
import { merge, cloneDeep, isPlainObject } from 'lodash';
import { JsonObject } from 'src/plugins/kibana_utils/common';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { FtrProviderContext } from '../../../common/ftr_provider_context';

const DEFAULT_INDEX_NAME = 'observability-annotations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { FtrProviderContext } from '../../../common/ftr_provider_context';

export default function rumServicesApiTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
Expand Down