Skip to content

Commit

Permalink
[APM] Add API test for service maps (elastic#70185)
Browse files Browse the repository at this point in the history
* [APM] Add API test for service maps

* Re-add custom links test

* Improved test names

* Disable eslint rule

* Undo readme changes

* Fix ts errors
  • Loading branch information
sorenlouv authored and Bamieh committed Jul 1, 2020
1 parent d15d1fb commit 8f1a2b1
Show file tree
Hide file tree
Showing 14 changed files with 25,987 additions and 9 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ module.exports = {
*/
{
files: [
'x-pack/test/apm_api_integration/**/*.ts',
'x-pack/test/functional/apps/**/*.js',
'x-pack/plugins/apm/**/*.js',
'test/*/config.ts',
Expand Down
1 change: 0 additions & 1 deletion x-pack/test/apm_api_integration/basic/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import { createTestConfig } from '../common/config';

// eslint-disable-next-line import/no-default-export
export default createTestConfig({
license: 'basic',
name: 'X-Pack APM API integration tests (basic)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import expect from '@kbn/expect';
import { AgentConfigurationIntake } from '../../../../plugins/apm/common/agent_configuration/configuration_types';
import { FtrProviderContext } from '../../common/ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function agentConfigurationTests({ getService }: FtrProviderContext) {
const supertestRead = getService('supertestAsApmReadUser');
const supertestWrite = getService('supertestAsApmWriteUser');
Expand Down
1 change: 0 additions & 1 deletion x-pack/test/apm_api_integration/basic/tests/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import expect from '@kbn/expect';
import { JsonObject } from 'src/plugins/kibana_utils/common';
import { FtrProviderContext } from '../../common/ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function annotationApiTests({ getService }: FtrProviderContext) {
const supertestWrite = getService('supertestAsApmAnnotationsWriteUser');

Expand Down
1 change: 0 additions & 1 deletion x-pack/test/apm_api_integration/basic/tests/custom_link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import expect from '@kbn/expect';
import { CustomLink } from '../../../../plugins/apm/common/custom_link/custom_link_types';
import { FtrProviderContext } from '../../common/ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function customLinksTests({ getService }: FtrProviderContext) {
const supertestRead = getService('supertestAsApmReadUser');
const supertestWrite = getService('supertestAsApmWriteUser');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../common/ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function featureControlsTests({ getService }: FtrProviderContext) {
const supertest = getService('supertestAsApmWriteUser');
const supertestWithoutAuth = getService('supertestWithoutAuth');
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/apm_api_integration/basic/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
import { FtrProviderContext } from '../../common/ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function apmApiIntegrationTests({ loadTestFile }: FtrProviderContext) {
describe('APM specs (basic)', function () {
this.tags('ciGroup1');
Expand All @@ -14,5 +13,6 @@ export default function apmApiIntegrationTests({ loadTestFile }: FtrProviderCont
loadTestFile(require.resolve('./feature_controls'));
loadTestFile(require.resolve('./agent_configuration'));
loadTestFile(require.resolve('./custom_link'));
loadTestFile(require.resolve('./service_maps'));
});
}
25 changes: 25 additions & 0 deletions x-pack/test/apm_api_integration/basic/tests/service_maps.ts
Original file line number Diff line number Diff line change
@@ -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;
* 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';

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

describe('Service Maps', () => {
it('should only be available to users with Platinum license (or higher)', async () => {
const response = await supertest.get(
'/api/apm/service-map?start=2020-06-28T10%3A24%3A46.055Z&end=2020-06-29T10%3A24%3A46.055Z'
);

expect(response.status).to.be(403);
expect(response.body.message).to.be(
"In order to access Service Maps, you must be subscribed to an Elastic Platinum license. With it, you'll have the ability to visualize your entire application stack along with your APM data."
);
});
});
}
1 change: 0 additions & 1 deletion x-pack/test/apm_api_integration/trial/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import { createTestConfig } from '../common/config';

// eslint-disable-next-line import/no-default-export
export default createTestConfig({
license: 'trial',
name: 'X-Pack APM API integration tests (trial)',
Expand Down
Binary file not shown.
Loading

0 comments on commit 8f1a2b1

Please sign in to comment.