[Stack Monitoring] fix beat api tests (#153466)

Closes https://github.com/elastic/kibana/issues/153123

### Summary
https://github.com/elastic/elasticsearch/pull/94400 added missing
aliases required by Stack Monitoring. Tests started to fail as they
expected the metrics related to these aliases to be empty since they
could not be queried, but now return associated data.
I've generated a new archive and updated the tests accordingly.

Tests use package build from
https://github.com/elastic/integrations/pull/5639.
This commit is contained in:
Kevin Lacabane 2023-03-23 12:26:12 +01:00 committed by GitHub
parent 847e78e65d
commit bca80be144
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 24 additions and 60 deletions

View file

@ -8,10 +8,8 @@
import { FtrProviderContext } from '../../../api_integration/ftr_provider_context';
export default function ({ loadTestFile }: FtrProviderContext) {
// Failing ES Promotion: https://github.com/elastic/kibana/issues/153123
describe.skip('APM', () => {
describe('APM', () => {
loadTestFile(require.resolve('./overview'));
loadTestFile(require.resolve('./instances'));
loadTestFile(require.resolve('./instance'));
});
}

View file

@ -1,41 +0,0 @@
/*
* 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 expect from '@kbn/expect';
import { FtrProviderContext } from '../../../api_integration/ftr_provider_context';
import { getTestRunner } from '../../utils/test_runner';
import response from '../../fixtures/apm/instance.json';
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const testRunner = getTestRunner({
testName: 'Instance',
archiveRoot: 'x-pack/test/monitoring_api_integration/archives/apm',
getService,
});
const timeRange = {
min: '2022-12-20T16:28:00.000Z',
max: '2022-12-20T16:32:00.000Z',
};
testRunner(() => {
it('should load individual apm server', async () => {
const { body } = await supertest
.post(
'/api/monitoring/v1/clusters/3_pOMySBSkCwdyxxBdDbvA/apm/503d57eb-6f1f-4991-89c3-34250cef80d1'
)
.set('kbn-xsrf', 'xxx')
.send({ timeRange })
.expect(200);
expect(body).to.eql(response);
});
});
}

View file

@ -9,7 +9,8 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../api_integration/ftr_provider_context';
import { getTestRunner } from '../../utils/test_runner';
import response from '../../fixtures/apm/instances.json';
import instancesResponse from '../../fixtures/apm/instances.json';
import instanceResponse from '../../fixtures/apm/instance.json';
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
@ -20,20 +21,29 @@ export default function ({ getService }: FtrProviderContext) {
getService,
});
const timeRange = {
min: '2022-12-20T16:28:00.000Z',
max: '2022-12-20T16:32:00.000Z',
};
const timeRange = { min: '2023-03-22T15:57:20.000Z', max: '2023-03-22T16:01:20.000Z' };
testRunner(() => {
it('should load apm servers', async () => {
const { body } = await supertest
.post('/api/monitoring/v1/clusters/3_pOMySBSkCwdyxxBdDbvA/apm/instances')
.post('/api/monitoring/v1/clusters/2aloVhnwR7K6CckdBgZ44w/apm/instances')
.set('kbn-xsrf', 'xxx')
.send({ timeRange })
.expect(200);
expect(body).to.eql(response);
expect(body).to.eql(instancesResponse);
});
it('should load individual apm server', async () => {
const { body } = await supertest
.post(
'/api/monitoring/v1/clusters/2aloVhnwR7K6CckdBgZ44w/apm/ccf6c4d9-37bc-4dd0-bf57-2ae3ee296a39'
)
.set('kbn-xsrf', 'xxx')
.send({ timeRange })
.expect(200);
expect(body).to.eql(instanceResponse);
});
});
}

View file

@ -20,15 +20,12 @@ export default function ({ getService }: FtrProviderContext) {
getService,
});
const timeRange = {
min: '2022-12-20T16:28:00.000Z',
max: '2022-12-20T16:32:00.000Z',
};
const timeRange = { min: '2023-03-22T15:57:20.000Z', max: '2023-03-22T16:01:20.000Z' };
testRunner(() => {
it('should summarize apm cluster with metrics', async () => {
const { body } = await supertest
.post('/api/monitoring/v1/clusters/3_pOMySBSkCwdyxxBdDbvA/apm')
.post('/api/monitoring/v1/clusters/2aloVhnwR7K6CckdBgZ44w/apm')
.set('kbn-xsrf', 'xxx')
.send({ timeRange })
.expect(200);

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
{"stats":{"totalEvents":1803,"apms":{"total":1},"timeOfLastEvent":"2022-12-20T16:31:53.427Z"},"apms":[{"uuid":"503d57eb-6f1f-4991-89c3-34250cef80d1","name":"42646a2ef4c2","type":"Apm-server","output":"Elasticsearch","total_events_rate":7.5125,"bytes_sent_rate":2805.175,"errors":0,"memory":108116392,"version":"8.7.0","time_of_last_event":"2022-12-20T16:31:53.427Z"}],"cgroup":false}
{"stats":{"totalEvents":1876,"apms":{"total":1},"timeOfLastEvent":"2023-03-22T16:01:17.098Z"},"apms":[{"uuid":"ccf6c4d9-37bc-4dd0-bf57-2ae3ee296a39","name":"3031a4a32eea","type":"Apm-server","output":"Elasticsearch","total_events_rate":7.816666666666666,"bytes_sent_rate":2856.5041666666666,"errors":0,"memory":47825208,"version":"8.7.0","time_of_last_event":"2023-03-22T16:01:17.098Z"}],"cgroup":false}

File diff suppressed because one or more lines are too long

View file

@ -8,7 +8,7 @@
import path from 'path';
const PACKAGES = [
{ name: 'beat', version: '0.0.1' },
{ name: 'beat', version: '0.1.3' },
{ name: 'elasticsearch', version: '1.4.1' },
{ name: 'enterprisesearch', version: '1.0.0' },
{ name: 'logstash', version: '2.2.2-preview1' },