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

[8.x] Migrate /test/apm_api_integration/tests/suggestions to be deployment agnostic api tests (#200556) #200678

Merged
Merged
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
Original file line number Diff line number Diff line change
@@ -36,5 +36,7 @@ export default function apmApiIntegrationTests({
loadTestFile(require.resolve('./diagnostics'));
loadTestFile(require.resolve('./service_nodes'));
loadTestFile(require.resolve('./span_links'));
loadTestFile(require.resolve('./suggestions'));
loadTestFile(require.resolve('./throughput'));
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* 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 type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context';

export default function ({ loadTestFile }: DeploymentAgnosticFtrProviderContext) {
describe('Suggestions', () => {
loadTestFile(require.resolve('./suggestions.spec.ts'));
});
}
Original file line number Diff line number Diff line change
@@ -11,7 +11,8 @@ import {
TRANSACTION_TYPE,
} from '@kbn/apm-plugin/common/es_fields/apm';
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import type { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace';
import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context';
import { generateData } from './generate_data';

const startNumber = new Date('2021-01-01T00:00:00.000Z').getTime();
@@ -20,14 +21,16 @@ const endNumber = new Date('2021-01-01T00:05:00.000Z').getTime() - 1;
const start = new Date(startNumber).toISOString();
const end = new Date(endNumber).toISOString();

export default function suggestionsTests({ getService }: FtrProviderContext) {
const registry = getService('registry');
const apmApiClient = getService('apmApiClient');
const apmSynthtraceEsClient = getService('apmSynthtraceEsClient');
export default function suggestionsTests({ getService }: DeploymentAgnosticFtrProviderContext) {
const apmApiClient = getService('apmApi');
const synthtrace = getService('synthtrace');

describe('suggestions when data is loaded', () => {
let apmSynthtraceEsClient: ApmSynthtraceEsClient;

// FLAKY: https://github.com/elastic/kibana/issues/177538
registry.when('suggestions when data is loaded', { config: 'basic', archives: [] }, async () => {
before(async () => {
apmSynthtraceEsClient = await synthtrace.createApmSynthtraceEsClient();

await generateData({
apmSynthtraceEsClient,
start: startNumber,
Original file line number Diff line number Diff line change
@@ -8,13 +8,13 @@ import { apm, timerange } from '@kbn/apm-synthtrace-client';
import expect from '@kbn/expect';
import { meanBy, sumBy } from 'lodash';
import { DependencyNode, ServiceNode } from '@kbn/apm-plugin/common/connections';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { roundNumber } from '../../utils';
import type { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace';
import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context';
import { roundNumber } from '../utils/common';

export default function ApiTest({ getService }: FtrProviderContext) {
const registry = getService('registry');
const apmApiClient = getService('apmApiClient');
const apmSynthtraceEsClient = getService('apmSynthtraceEsClient');
export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) {
const apmApiClient = getService('apmApi');
const synthtrace = getService('synthtrace');

const start = new Date('2021-01-01T00:00:00.000Z').getTime();
const end = new Date('2021-01-01T00:15:00.000Z').getTime() - 1;
@@ -93,18 +93,20 @@ export default function ApiTest({ getService }: FtrProviderContext) {

let throughputValues: Awaited<ReturnType<typeof getThroughputValues>>;

// FLAKY: https://github.com/elastic/kibana/issues/177536
registry.when.skip('Dependencies throughput value', { config: 'basic', archives: [] }, () => {
describe('Dependencies throughput value', () => {
describe('when data is loaded', () => {
const GO_PROD_RATE = 75;
const JAVA_PROD_RATE = 25;
let apmSynthtraceEsClient: ApmSynthtraceEsClient;

before(async () => {
const serviceGoProdInstance = apm
.service({ name: 'synth-go', environment: 'production', agentName: 'go' })
.instance('instance-a');
const serviceJavaInstance = apm
.service({ name: 'synth-java', environment: 'development', agentName: 'java' })
.instance('instance-c');
apmSynthtraceEsClient = await synthtrace.createApmSynthtraceEsClient();

await apmSynthtraceEsClient.index([
timerange(start, end)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* 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 type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context';

export default function ({ loadTestFile }: DeploymentAgnosticFtrProviderContext) {
describe('Throughput', () => {
loadTestFile(require.resolve('./dependencies_apis.spec.ts'));
loadTestFile(require.resolve('./service_apis.spec.ts'));
loadTestFile(require.resolve('./service_maps.spec.ts'));
});
}
Original file line number Diff line number Diff line change
@@ -11,13 +11,13 @@ import { apm, timerange } from '@kbn/apm-synthtrace-client';
import expect from '@kbn/expect';
import { ProcessorEvent } from '@kbn/observability-plugin/common';
import { meanBy, sumBy } from 'lodash';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { roundNumber } from '../../utils';
import type { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace';
import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context';
import { roundNumber } from '../utils/common';

export default function ApiTest({ getService }: FtrProviderContext) {
const registry = getService('registry');
const apmApiClient = getService('apmApiClient');
const apmSynthtraceEsClient = getService('apmSynthtraceEsClient');
export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) {
const apmApiClient = getService('apmApi');
const synthtrace = getService('synthtrace');

const serviceName = 'synth-go';
const start = new Date('2021-01-01T00:00:00.000Z').getTime();
@@ -141,18 +141,20 @@ export default function ApiTest({ getService }: FtrProviderContext) {
let throughputMetricValues: Awaited<ReturnType<typeof getThroughputValues>>;
let throughputTransactionValues: Awaited<ReturnType<typeof getThroughputValues>>;

// FLAKY: https://github.com/elastic/kibana/issues/177535
registry.when('Services APIs', { config: 'basic', archives: [] }, () => {
describe('Services APIs', () => {
describe('when data is loaded ', () => {
const GO_PROD_RATE = 80;
const GO_DEV_RATE = 20;
let apmSynthtraceEsClient: ApmSynthtraceEsClient;

before(async () => {
const serviceGoProdInstance = apm
.service({ name: serviceName, environment: 'production', agentName: 'go' })
.instance('instance-a');
const serviceGoDevInstance = apm
.service({ name: serviceName, environment: 'development', agentName: 'go' })
.instance('instance-b');
apmSynthtraceEsClient = await synthtrace.createApmSynthtraceEsClient();

await apmSynthtraceEsClient.index([
timerange(start, end)
Original file line number Diff line number Diff line change
@@ -9,13 +9,13 @@ import expect from '@kbn/expect';
import { ApmDocumentType } from '@kbn/apm-plugin/common/document_type';
import { RollupInterval } from '@kbn/apm-plugin/common/rollup';
import { ProcessorEvent } from '@kbn/observability-plugin/common';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { roundNumber } from '../../utils';
import type { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace';
import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context';
import { roundNumber } from '../utils/common';

export default function ApiTest({ getService }: FtrProviderContext) {
const registry = getService('registry');
const apmApiClient = getService('apmApiClient');
const apmSynthtraceEsClient = getService('apmSynthtraceEsClient');
export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) {
const apmApiClient = getService('apmApi');
const synthtrace = getService('synthtrace');

const serviceName = 'synth-go';
const start = new Date('2021-01-01T00:00:00.000Z').getTime();
@@ -83,17 +83,20 @@ export default function ApiTest({ getService }: FtrProviderContext) {
let throughputMetricValues: Awaited<ReturnType<typeof getThroughputValues>>;
let throughputTransactionValues: Awaited<ReturnType<typeof getThroughputValues>>;

registry.when('Service Maps APIs', { config: 'trial', archives: [] }, () => {
describe('Service Maps APIs', () => {
describe('when data is loaded ', () => {
const GO_PROD_RATE = 80;
const GO_DEV_RATE = 20;
let apmSynthtraceEsClient: ApmSynthtraceEsClient;

before(async () => {
const serviceGoProdInstance = apm
.service({ name: serviceName, environment: 'production', agentName: 'go' })
.instance('instance-a');
const serviceGoDevInstance = apm
.service({ name: serviceName, environment: 'development', agentName: 'go' })
.instance('instance-b');
apmSynthtraceEsClient = await synthtrace.createApmSynthtraceEsClient();

await apmSynthtraceEsClient.index([
timerange(start, end)
@@ -119,7 +122,6 @@ export default function ApiTest({ getService }: FtrProviderContext) {

after(() => apmSynthtraceEsClient.clean());

// FLAKY: https://github.com/elastic/kibana/issues/176984
describe('compare throughput value between service inventory and service maps', () => {
before(async () => {
[throughputTransactionValues, throughputMetricValues] = await Promise.all([
@@ -136,7 +138,6 @@ export default function ApiTest({ getService }: FtrProviderContext) {
});
});

// FLAKY: https://github.com/elastic/kibana/issues/176987
describe('when calling service maps transactions stats api', () => {
let serviceMapsNodeThroughput: number | null | undefined;
before(async () => {