From 280c6d4d71998f318fbec6a8338d1ffac3b12c43 Mon Sep 17 00:00:00 2001 From: Dario Gieselaar Date: Fri, 22 Jan 2021 18:45:04 +0100 Subject: [PATCH] Use module instead of service to register tests --- .../test/apm_api_integration/common/config.ts | 5 +- .../apm_api_integration/common/registry.ts | 143 ++++++++++++++++++ .../common/test_registry_provider.ts | 135 ----------------- .../tests/alerts/chart_preview.ts | 2 +- .../tests/correlations/slow_transactions.ts | 66 ++++---- .../tests/csm/csm_services.ts | 2 +- .../tests/csm/has_rum_data.ts | 2 +- .../tests/csm/js_errors.ts | 3 +- .../tests/csm/long_task_metrics.ts | 2 +- .../tests/csm/page_load_dist.ts | 2 +- .../tests/csm/page_views.ts | 2 +- .../tests/csm/url_search.ts | 2 +- .../tests/csm/web_core_vitals.ts | 3 +- .../tests/feature_controls.ts | 3 +- .../test/apm_api_integration/tests/index.ts | 5 +- .../tests/metrics_charts/metrics_charts.ts | 2 +- .../tests/observability_overview/has_data.ts | 2 +- .../observability_overview.ts | 2 +- .../tests/service_maps/service_maps.ts | 3 +- .../service_overview/dependencies/index.ts | 2 +- .../tests/service_overview/error_groups.ts | 2 +- .../tests/service_overview/instances.ts | 2 +- .../services/__snapshots__/throughput.snap | 2 +- .../tests/services/agent_name.ts | 2 +- .../tests/services/annotations.ts | 3 +- .../tests/services/service_details.ts | 2 +- .../tests/services/service_icons.ts | 2 +- .../tests/services/throughput.ts | 2 +- .../tests/services/top_services.ts | 2 +- .../tests/services/transaction_types.ts | 2 +- .../tests/settings/agent_configuration.ts | 2 +- .../tests/settings/anomaly_detection/basic.ts | 3 +- .../anomaly_detection/no_access_user.ts | 3 +- .../settings/anomaly_detection/read_user.ts | 2 +- .../settings/anomaly_detection/write_user.ts | 2 +- .../tests/settings/custom_link.ts | 3 +- .../tests/traces/top_traces.ts | 2 +- .../tests/transactions/breakdown.ts | 2 +- .../tests/transactions/distribution.ts | 2 +- .../tests/transactions/error_rate.ts | 2 +- .../tests/transactions/latency.ts | 3 +- .../tests/transactions/throughput.ts | 2 +- .../transactions/top_transaction_groups.ts | 2 +- .../transactions_groups_overview.ts | 2 +- 44 files changed, 218 insertions(+), 223 deletions(-) create mode 100644 x-pack/test/apm_api_integration/common/registry.ts delete mode 100644 x-pack/test/apm_api_integration/common/test_registry_provider.ts diff --git a/x-pack/test/apm_api_integration/common/config.ts b/x-pack/test/apm_api_integration/common/config.ts index 6a136e9a81008a..08333de15ec6de 100644 --- a/x-pack/test/apm_api_integration/common/config.ts +++ b/x-pack/test/apm_api_integration/common/config.ts @@ -11,8 +11,8 @@ import path from 'path'; import { InheritedFtrProviderContext, InheritedServices } from './ftr_provider_context'; import { PromiseReturnType } from '../../../plugins/observability/typings/common'; import { createApmUser, APM_TEST_PASSWORD, ApmUser } from './authentication'; -import { createTestRegistryProvider } from './test_registry_provider'; import { APMFtrConfigName } from '../configs'; +import { registry } from './registry'; interface Config { name: APMFtrConfigName; @@ -48,6 +48,8 @@ export function createTestConfig(config: Config) { const supertestAsApmReadUser = supertestAsApmUser(servers.kibana, ApmUser.apmReadUser); + registry.init(config.name); + return { testFiles: [require.resolve('../tests')], servers, @@ -56,7 +58,6 @@ export function createTestConfig(config: Config) { }, services: { ...services, - registry: createTestRegistryProvider(config.name), supertest: supertestAsApmReadUser, supertestAsApmReadUser, supertestAsNoAccessUser: supertestAsApmUser(servers.kibana, ApmUser.noAccessUser), diff --git a/x-pack/test/apm_api_integration/common/registry.ts b/x-pack/test/apm_api_integration/common/registry.ts new file mode 100644 index 00000000000000..30de8f8e2ac0c7 --- /dev/null +++ b/x-pack/test/apm_api_integration/common/registry.ts @@ -0,0 +1,143 @@ +/* + * 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 { castArray, once, groupBy } from 'lodash'; +import { joinByKey } from '../../../plugins/apm/common/utils/join_by_key'; +import { APMFtrConfigName } from '../configs'; +import { FtrProviderContext } from './ftr_provider_context'; + +type ArchiveName = + | 'apm_8.0.0' + | '8.0.0' + | 'metrics_8.0.0' + | 'ml_8.0.0' + | 'observability_overview' + | 'rum_8.0.0' + | 'rum_test_data'; + +interface RunCondition { + config: APMFtrConfigName; + archives: ArchiveName[]; +} + +const onlyOnce = any>(cb: T): T => { + const called: boolean = false; + + return ((...args: any[]) => { + if (called) { + throw new Error('Function can only be called once'); + } + return cb(...args); + }) as T; +}; + +const callbacks: Array< + RunCondition & { + runs: Array<{ + cb: (beforeFn: (...args: any[]) => any, afterFn: (...args: any[]) => any) => void; + }>; + } +> = []; + +let configName: APMFtrConfigName | undefined; + +export const registry = { + init: onlyOnce((config: APMFtrConfigName) => { + configName = config; + }), + when: ( + title: string, + conditions: RunCondition | RunCondition[], + callback: (condition: RunCondition) => void + ) => { + const allConditions = castArray(conditions); + + if (!allConditions.length) { + throw new Error('At least one condition should be defined'); + } + + allConditions.forEach((matchedCondition) => { + callbacks.push({ + ...matchedCondition, + runs: [ + { + cb: () => { + describe(title, () => { + callback(matchedCondition); + }); + }, + }, + ], + }); + }); + }, + run: onlyOnce((context: FtrProviderContext) => { + if (!configName) { + throw new Error(`registry was not init() before running`); + } + const esArchiver = context.getService('esArchiver'); + const logger = context.getService('log'); + const logWithTimer = () => { + const start = process.hrtime(); + + return (message: string) => { + const diff = process.hrtime(start); + const time = `${Math.round(diff[0] * 1000 + diff[1] / 1e6)}ms`; + logger.info(`(${time}) ${message}`); + }; + }; + + const groups = joinByKey(callbacks, ['config', 'archives'], (a, b) => ({ + ...a, + ...b, + runs: a.runs.concat(b.runs), + })); + + const byConfig = groupBy(groups, 'config'); + + Object.keys(byConfig).forEach((config) => { + const groupsForConfig = byConfig[config]; + // register suites for other configs, but skip them so tests are marked as such + // and their snapshots are not marked as obsolete + (config === configName ? describe : describe.skip)(config, () => { + groupsForConfig.forEach((group) => { + const { runs, ...condition } = group; + + const runBefore = once(async () => { + const log = logWithTimer(); + for (const archiveName of condition.archives) { + log(`Loading ${archiveName}`); + await esArchiver.load(archiveName); + } + if (condition.archives.length) { + log('Loaded all archives'); + } + }); + + const runAfter = once(async () => { + const log = logWithTimer(); + for (const archiveName of condition.archives) { + log(`Unloading ${archiveName}`); + await esArchiver.unload(archiveName); + } + if (condition.archives.length) { + log('Unloaded all archives'); + } + }); + + describe(condition.archives.join(',') || 'no data', () => { + before(runBefore); + + runs.forEach((run) => { + run.cb(runBefore, runAfter); + }); + + after(runAfter); + }); + }); + }); + }); + }), +}; diff --git a/x-pack/test/apm_api_integration/common/test_registry_provider.ts b/x-pack/test/apm_api_integration/common/test_registry_provider.ts deleted file mode 100644 index 5b9fbb222570a0..00000000000000 --- a/x-pack/test/apm_api_integration/common/test_registry_provider.ts +++ /dev/null @@ -1,135 +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; - * you may not use this file except in compliance with the Elastic License. - */ -import { castArray, once } from 'lodash'; -import { joinByKey } from '../../../plugins/apm/common/utils/join_by_key'; -import { InheritedFtrProviderContext } from './ftr_provider_context'; - -type ArchiveName = - | 'apm_8.0.0' - | '8.0.0' - | 'metrics_8.0.0' - | 'ml_8.0.0' - | 'observability_overview' - | 'rum_8.0.0' - | 'rum_test_data'; - -interface RunCondition { - config: T; - archives: ArchiveName[]; -} - -const onlyOnce = any>(cb: T): T => { - const called: boolean = false; - - return ((...args: any[]) => { - if (called) { - throw new Error('Function can only be called once'); - } - return cb(...args); - }) as T; -}; - -export const createTestRegistryProvider = (config: T) => ( - context: InheritedFtrProviderContext -) => { - const callbacks: Array< - RunCondition & { - runs: Array<{ - cb: (beforeFn: (...args: any[]) => any, afterFn: (...args: any[]) => any) => void; - }>; - } - > = []; - - const esArchiver = context.getService('esArchiver'); - - const logger = context.getService('log'); - - const logWithTimer = () => { - const start = process.hrtime(); - - return (message: string) => { - const diff = process.hrtime(start); - const time = `${Math.round(diff[0] * 1000 + diff[1] / 1e6)}ms`; - logger.info(`(${time}) ${message}`); - }; - }; - - return { - when: ( - title: string, - conditions: RunCondition | Array>, - callback: (condition: RunCondition) => void - ) => { - const allConditions = castArray(conditions); - - if (!allConditions.length) { - throw new Error('At least one condition should be defined'); - } - - allConditions - .filter((condition) => condition.config === config) - .forEach((matchedCondition) => { - callbacks.push({ - ...matchedCondition, - runs: [ - { - cb: () => { - describe(title, () => { - callback(matchedCondition); - }); - }, - }, - ], - }); - }); - }, - run: onlyOnce(() => { - const groups = joinByKey(callbacks, 'archives', (a, b) => ({ - ...a, - ...b, - runs: a.runs.concat(b.runs), - })); - - describe(config, () => { - groups.forEach((group) => { - const { runs, ...condition } = group; - - const runBefore = once(async () => { - const log = logWithTimer(); - for (const archiveName of condition.archives) { - log(`Loading ${archiveName}`); - await esArchiver.load(archiveName); - } - if (condition.archives.length) { - log('Loaded all archives'); - } - }); - - const runAfter = once(async () => { - const log = logWithTimer(); - for (const archiveName of condition.archives) { - log(`Unloading ${archiveName}`); - await esArchiver.unload(archiveName); - } - if (condition.archives.length) { - log('Unloaded all archives'); - } - }); - - describe(condition.archives.join(',') || 'no data', () => { - before(runBefore); - - runs.forEach((run) => { - run.cb(runBefore, runAfter); - }); - - after(runAfter); - }); - }); - }); - }), - }; -}; diff --git a/x-pack/test/apm_api_integration/tests/alerts/chart_preview.ts b/x-pack/test/apm_api_integration/tests/alerts/chart_preview.ts index 387135d9a7bf14..2b14e3b8a4a75e 100644 --- a/x-pack/test/apm_api_integration/tests/alerts/chart_preview.ts +++ b/x-pack/test/apm_api_integration/tests/alerts/chart_preview.ts @@ -8,9 +8,9 @@ import expect from '@kbn/expect'; import { format } from 'url'; import archives from '../../common/fixtures/es_archiver/archives_metadata'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { - const registry = getService('registry'); const supertest = getService('supertest'); const archiveName = 'apm_8.0.0'; const { end } = archives[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/correlations/slow_transactions.ts b/x-pack/test/apm_api_integration/tests/correlations/slow_transactions.ts index a0fd7039b29bf4..2439943a664eac 100644 --- a/x-pack/test/apm_api_integration/tests/correlations/slow_transactions.ts +++ b/x-pack/test/apm_api_integration/tests/correlations/slow_transactions.ts @@ -9,10 +9,10 @@ import { format } from 'url'; import { APIReturnType } from '../../../../plugins/apm/public/services/rest/createCallApmApi'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const range = archives_metadata[archiveName]; @@ -27,37 +27,33 @@ export default function ApiTest({ getService }: FtrProviderContext) { }, }); - describe('Slow transactions', () => { - registry.when('without data', { config: 'trial', archives: [] }, () => { - it('handles the empty state', async () => { - const response = await supertest.get(url); + registry.when('without data', { config: 'trial', archives: [] }, () => { + it('handles the empty state', async () => { + const response = await supertest.get(url); - expect(response.status).to.be(200); - expect(response.body.response).to.be(undefined); - }); + expect(response.status).to.be(200); + expect(response.body.response).to.be(undefined); }); + }); - registry.when( - 'with data and default args', - { config: 'trial', archives: ['apm_8.0.0'] }, - () => { - type ResponseBody = APIReturnType<'GET /api/apm/correlations/slow_transactions'>; - let response: { - status: number; - body: NonNullable; - }; + registry.when('with data and default args', { config: 'trial', archives: ['apm_8.0.0'] }, () => { + type ResponseBody = APIReturnType<'GET /api/apm/correlations/slow_transactions'>; + let response: { + status: number; + body: NonNullable; + }; - before(async () => { - response = await supertest.get(url); - }); + before(async () => { + response = await supertest.get(url); + }); - it('returns successfully', () => { - expect(response.status).to.eql(200); - }); + it('returns successfully', () => { + expect(response.status).to.eql(200); + }); - it('returns significant terms', () => { - const sorted = response.body?.significantTerms?.sort(); - expectSnapshot(sorted?.map((term) => term.fieldName)).toMatchInline(` + it('returns significant terms', () => { + const sorted = response.body?.significantTerms?.sort(); + expectSnapshot(sorted?.map((term) => term.fieldName)).toMatchInline(` Array [ "user_agent.name", "url.domain", @@ -68,11 +64,11 @@ export default function ApiTest({ getService }: FtrProviderContext) { "user_agent.name", ] `); - }); + }); - it('returns a distribution per term', () => { - expectSnapshot(response.body?.significantTerms?.map((term) => term.distribution.length)) - .toMatchInline(` + it('returns a distribution per term', () => { + expectSnapshot(response.body?.significantTerms?.map((term) => term.distribution.length)) + .toMatchInline(` Array [ 11, 11, @@ -83,12 +79,10 @@ export default function ApiTest({ getService }: FtrProviderContext) { 11, ] `); - }); + }); - it('returns overall distribution', () => { - expectSnapshot(response.body?.overall?.distribution.length).toMatchInline(`11`); - }); - } - ); + it('returns overall distribution', () => { + expectSnapshot(response.body?.overall?.distribution.length).toMatchInline(`11`); + }); }); } diff --git a/x-pack/test/apm_api_integration/tests/csm/csm_services.ts b/x-pack/test/apm_api_integration/tests/csm/csm_services.ts index c376701d9d5eef..6460c0832a9476 100644 --- a/x-pack/test/apm_api_integration/tests/csm/csm_services.ts +++ b/x-pack/test/apm_api_integration/tests/csm/csm_services.ts @@ -6,10 +6,10 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function rumServicesApiTests({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); registry.when('CSM Services without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { diff --git a/x-pack/test/apm_api_integration/tests/csm/has_rum_data.ts b/x-pack/test/apm_api_integration/tests/csm/has_rum_data.ts index c71fd48a2b4654..66f99dd29df5a5 100644 --- a/x-pack/test/apm_api_integration/tests/csm/has_rum_data.ts +++ b/x-pack/test/apm_api_integration/tests/csm/has_rum_data.ts @@ -6,10 +6,10 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function rumHasDataApiTests({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); registry.when('has_rum_data without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { diff --git a/x-pack/test/apm_api_integration/tests/csm/js_errors.ts b/x-pack/test/apm_api_integration/tests/csm/js_errors.ts index 5a4683c777164a..dcadc8424ef7e9 100644 --- a/x-pack/test/apm_api_integration/tests/csm/js_errors.ts +++ b/x-pack/test/apm_api_integration/tests/csm/js_errors.ts @@ -6,12 +6,11 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function rumJsErrorsApiTests({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); - registry.when('CSM JS errors with data', { config: 'trial', archives: [] }, () => { it('returns no js errors', async () => { const response = await supertest.get( diff --git a/x-pack/test/apm_api_integration/tests/csm/long_task_metrics.ts b/x-pack/test/apm_api_integration/tests/csm/long_task_metrics.ts index f09a96e47216c2..0da0889c11775b 100644 --- a/x-pack/test/apm_api_integration/tests/csm/long_task_metrics.ts +++ b/x-pack/test/apm_api_integration/tests/csm/long_task_metrics.ts @@ -6,10 +6,10 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function rumServicesApiTests({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); registry.when('CSM long task metrics without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { diff --git a/x-pack/test/apm_api_integration/tests/csm/page_load_dist.ts b/x-pack/test/apm_api_integration/tests/csm/page_load_dist.ts index dade9fdfc8c43f..28fa9cb87f5162 100644 --- a/x-pack/test/apm_api_integration/tests/csm/page_load_dist.ts +++ b/x-pack/test/apm_api_integration/tests/csm/page_load_dist.ts @@ -6,10 +6,10 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function rumServicesApiTests({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); registry.when('UX page load dist without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { diff --git a/x-pack/test/apm_api_integration/tests/csm/page_views.ts b/x-pack/test/apm_api_integration/tests/csm/page_views.ts index cb71c2a0d9aed9..43f9d278f694a5 100644 --- a/x-pack/test/apm_api_integration/tests/csm/page_views.ts +++ b/x-pack/test/apm_api_integration/tests/csm/page_views.ts @@ -6,10 +6,10 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function rumServicesApiTests({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); registry.when('CSM page views without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { diff --git a/x-pack/test/apm_api_integration/tests/csm/url_search.ts b/x-pack/test/apm_api_integration/tests/csm/url_search.ts index 6e51ec43bdbd9f..906f1783cb90e4 100644 --- a/x-pack/test/apm_api_integration/tests/csm/url_search.ts +++ b/x-pack/test/apm_api_integration/tests/csm/url_search.ts @@ -6,10 +6,10 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function rumServicesApiTests({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); registry.when('CSM url search api without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { diff --git a/x-pack/test/apm_api_integration/tests/csm/web_core_vitals.ts b/x-pack/test/apm_api_integration/tests/csm/web_core_vitals.ts index 458c0febccb623..3574ef065eef7d 100644 --- a/x-pack/test/apm_api_integration/tests/csm/web_core_vitals.ts +++ b/x-pack/test/apm_api_integration/tests/csm/web_core_vitals.ts @@ -6,12 +6,11 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function rumServicesApiTests({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); - registry.when('CSM web core vitals without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { const response = await supertest.get( diff --git a/x-pack/test/apm_api_integration/tests/feature_controls.ts b/x-pack/test/apm_api_integration/tests/feature_controls.ts index 0c2147e8d442f7..7a65d8114c73ff 100644 --- a/x-pack/test/apm_api_integration/tests/feature_controls.ts +++ b/x-pack/test/apm_api_integration/tests/feature_controls.ts @@ -6,6 +6,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../common/ftr_provider_context'; +import { registry } from '../common/registry'; export default function featureControlsTests({ getService }: FtrProviderContext) { const supertest = getService('supertestAsApmWriteUser'); @@ -15,8 +16,6 @@ export default function featureControlsTests({ getService }: FtrProviderContext) const es = getService('legacyEs'); const log = getService('log'); - const registry = getService('registry'); - const start = encodeURIComponent(new Date(Date.now() - 10000).toISOString()); const end = encodeURIComponent(new Date().toISOString()); diff --git a/x-pack/test/apm_api_integration/tests/index.ts b/x-pack/test/apm_api_integration/tests/index.ts index a9705bee651f89..eef82c714b2d06 100644 --- a/x-pack/test/apm_api_integration/tests/index.ts +++ b/x-pack/test/apm_api_integration/tests/index.ts @@ -5,9 +5,10 @@ */ import { FtrProviderContext } from '../common/ftr_provider_context'; +import { registry } from '../common/registry'; export default function apmApiIntegrationTests(providerContext: FtrProviderContext) { - const { loadTestFile, getService } = providerContext; + const { loadTestFile } = providerContext; describe('APM API tests', function () { this.tags('ciGroup1'); @@ -64,6 +65,6 @@ export default function apmApiIntegrationTests(providerContext: FtrProviderConte loadTestFile(require.resolve('./feature_controls')); - getService('registry').run(); + registry.run(providerContext); }); } diff --git a/x-pack/test/apm_api_integration/tests/metrics_charts/metrics_charts.ts b/x-pack/test/apm_api_integration/tests/metrics_charts/metrics_charts.ts index fdeb073a9a3b5e..dda46f00d7c725 100644 --- a/x-pack/test/apm_api_integration/tests/metrics_charts/metrics_charts.ts +++ b/x-pack/test/apm_api_integration/tests/metrics_charts/metrics_charts.ts @@ -8,6 +8,7 @@ import { first } from 'lodash'; import { MetricsChartsByAgentAPIResponse } from '../../../../plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent'; import { GenericMetricsChart } from '../../../../plugins/apm/server/lib/metrics/transform_metrics_chart'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; interface ChartResponse { body: MetricsChartsByAgentAPIResponse; @@ -16,7 +17,6 @@ interface ChartResponse { export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); registry.when( 'Metrics charts when data is loaded', diff --git a/x-pack/test/apm_api_integration/tests/observability_overview/has_data.ts b/x-pack/test/apm_api_integration/tests/observability_overview/has_data.ts index 2ffec67fffdaa2..9c88f75c6adbd0 100644 --- a/x-pack/test/apm_api_integration/tests/observability_overview/has_data.ts +++ b/x-pack/test/apm_api_integration/tests/observability_overview/has_data.ts @@ -5,10 +5,10 @@ */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); registry.when( 'Observability overview when data is not loaded', diff --git a/x-pack/test/apm_api_integration/tests/observability_overview/observability_overview.ts b/x-pack/test/apm_api_integration/tests/observability_overview/observability_overview.ts index 9f90ec074517e4..7c9d8fa8b0f91b 100644 --- a/x-pack/test/apm_api_integration/tests/observability_overview/observability_overview.ts +++ b/x-pack/test/apm_api_integration/tests/observability_overview/observability_overview.ts @@ -6,10 +6,10 @@ import expect from '@kbn/expect'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const metadata = archives_metadata[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/service_maps/service_maps.ts b/x-pack/test/apm_api_integration/tests/service_maps/service_maps.ts index b231f69e599a66..a15f0442c7cde6 100644 --- a/x-pack/test/apm_api_integration/tests/service_maps/service_maps.ts +++ b/x-pack/test/apm_api_integration/tests/service_maps/service_maps.ts @@ -10,13 +10,12 @@ import { isEmpty, uniq } from 'lodash'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { PromiseReturnType } from '../../../../plugins/observability/typings/common'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function serviceMapsApiTests({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const supertestAsApmReadUserWithoutMlAccess = getService('supertestAsApmReadUserWithoutMlAccess'); - const registry = getService('registry'); - const archiveName = 'apm_8.0.0'; const metadata = archives_metadata[archiveName]; const start = encodeURIComponent(metadata.start); diff --git a/x-pack/test/apm_api_integration/tests/service_overview/dependencies/index.ts b/x-pack/test/apm_api_integration/tests/service_overview/dependencies/index.ts index ddca7764ba5f62..b3e7e0672fc7fe 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/dependencies/index.ts +++ b/x-pack/test/apm_api_integration/tests/service_overview/dependencies/index.ts @@ -8,6 +8,7 @@ import expect from '@kbn/expect'; import url from 'url'; import { sortBy, pick, last } from 'lodash'; import { ValuesType } from 'utility-types'; +import { registry } from '../../../common/registry'; import { Maybe } from '../../../../../plugins/apm/typings/common'; import { isFiniteNumber } from '../../../../../plugins/apm/common/utils/is_finite_number'; import { APIReturnType } from '../../../../../plugins/apm/public/services/rest/createCallApmApi'; @@ -20,7 +21,6 @@ const round = (num: Maybe): string => (isFiniteNumber(num) ? num.toPreci export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const es = getService('es'); const archiveName = 'apm_8.0.0'; diff --git a/x-pack/test/apm_api_integration/tests/service_overview/error_groups.ts b/x-pack/test/apm_api_integration/tests/service_overview/error_groups.ts index cf564fc0668aab..fc649c60103c81 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/error_groups.ts +++ b/x-pack/test/apm_api_integration/tests/service_overview/error_groups.ts @@ -9,10 +9,10 @@ import qs from 'querystring'; import { pick, uniqBy } from 'lodash'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import archives from '../../common/fixtures/es_archiver/archives_metadata'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const { start, end } = archives[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/service_overview/instances.ts b/x-pack/test/apm_api_integration/tests/service_overview/instances.ts index ac173b72f966fc..08d60f90900b83 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/instances.ts +++ b/x-pack/test/apm_api_integration/tests/service_overview/instances.ts @@ -11,10 +11,10 @@ import { isFiniteNumber } from '../../../../plugins/apm/common/utils/is_finite_n import { APIReturnType } from '../../../../plugins/apm/public/services/rest/createCallApmApi'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import archives from '../../common/fixtures/es_archiver/archives_metadata'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const { start, end } = archives[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/services/__snapshots__/throughput.snap b/x-pack/test/apm_api_integration/tests/services/__snapshots__/throughput.snap index 133ef43d4da99c..f23601fccb1747 100644 --- a/x-pack/test/apm_api_integration/tests/services/__snapshots__/throughput.snap +++ b/x-pack/test/apm_api_integration/tests/services/__snapshots__/throughput.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`APM API tests basic apm_8.0.0 Throughput when data is loaded retjurns the service throughput has the correct throughput 1`] = ` +exports[`APM API tests basic apm_8.0.0 Throughput when data is loaded has the correct throughput 1`] = ` Array [ Object { "x": 1607435850000, diff --git a/x-pack/test/apm_api_integration/tests/services/agent_name.ts b/x-pack/test/apm_api_integration/tests/services/agent_name.ts index 9c324819848669..538d7a448ea30c 100644 --- a/x-pack/test/apm_api_integration/tests/services/agent_name.ts +++ b/x-pack/test/apm_api_integration/tests/services/agent_name.ts @@ -7,10 +7,10 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import archives from '../../common/fixtures/es_archiver/archives_metadata'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const range = archives[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/services/annotations.ts b/x-pack/test/apm_api_integration/tests/services/annotations.ts index 57fc2dda13f55c..4ff690fa01aa11 100644 --- a/x-pack/test/apm_api_integration/tests/services/annotations.ts +++ b/x-pack/test/apm_api_integration/tests/services/annotations.ts @@ -8,6 +8,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 { registry } from '../../common/registry'; const DEFAULT_INDEX_NAME = 'observability-annotations'; @@ -16,8 +17,6 @@ export default function annotationApiTests({ getService }: FtrProviderContext) { const supertestWrite = getService('supertestAsApmAnnotationsWriteUser'); const es = getService('es'); - const registry = getService('registry'); - function expectContainsObj(source: JsonObject, expected: JsonObject) { expect(source).to.eql( merge(cloneDeep(source), expected, (a: any, b: any) => { diff --git a/x-pack/test/apm_api_integration/tests/services/service_details.ts b/x-pack/test/apm_api_integration/tests/services/service_details.ts index d1c9f0477cee86..77155c907f3b14 100644 --- a/x-pack/test/apm_api_integration/tests/services/service_details.ts +++ b/x-pack/test/apm_api_integration/tests/services/service_details.ts @@ -8,10 +8,10 @@ import expect from '@kbn/expect'; import url from 'url'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import archives from '../../common/fixtures/es_archiver/archives_metadata'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const { start, end } = archives[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/services/service_icons.ts b/x-pack/test/apm_api_integration/tests/services/service_icons.ts index b4a088a8d3e38e..7926a2744e45c6 100644 --- a/x-pack/test/apm_api_integration/tests/services/service_icons.ts +++ b/x-pack/test/apm_api_integration/tests/services/service_icons.ts @@ -8,10 +8,10 @@ import expect from '@kbn/expect'; import url from 'url'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import archives from '../../common/fixtures/es_archiver/archives_metadata'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const { start, end } = archives[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/services/throughput.ts b/x-pack/test/apm_api_integration/tests/services/throughput.ts index 0d80de2506f99f..fa94cbf6007098 100644 --- a/x-pack/test/apm_api_integration/tests/services/throughput.ts +++ b/x-pack/test/apm_api_integration/tests/services/throughput.ts @@ -8,10 +8,10 @@ import qs from 'querystring'; import { first, last } from 'lodash'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const metadata = archives_metadata[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/services/top_services.ts b/x-pack/test/apm_api_integration/tests/services/top_services.ts index fc52c74a79d794..42797e3e7c87a8 100644 --- a/x-pack/test/apm_api_integration/tests/services/top_services.ts +++ b/x-pack/test/apm_api_integration/tests/services/top_services.ts @@ -10,11 +10,11 @@ import { APIReturnType } from '../../../../plugins/apm/public/services/rest/crea import { PromiseReturnType } from '../../../../plugins/observability/typings/common'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const supertestAsApmReadUserWithoutMlAccess = getService('supertestAsApmReadUserWithoutMlAccess'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; diff --git a/x-pack/test/apm_api_integration/tests/services/transaction_types.ts b/x-pack/test/apm_api_integration/tests/services/transaction_types.ts index 0f6a553db6c4c7..c45f4083ef8dab 100644 --- a/x-pack/test/apm_api_integration/tests/services/transaction_types.ts +++ b/x-pack/test/apm_api_integration/tests/services/transaction_types.ts @@ -7,10 +7,10 @@ import expect from '@kbn/expect'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const metadata = archives_metadata[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/settings/agent_configuration.ts b/x-pack/test/apm_api_integration/tests/settings/agent_configuration.ts index 9a9c8ea4593c84..0b58dd5908c60a 100644 --- a/x-pack/test/apm_api_integration/tests/settings/agent_configuration.ts +++ b/x-pack/test/apm_api_integration/tests/settings/agent_configuration.ts @@ -9,12 +9,12 @@ 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 { registry } from '../../common/registry'; export default function agentConfigurationTests({ getService }: FtrProviderContext) { const supertestRead = getService('supertestAsApmReadUser'); const supertestWrite = getService('supertestAsApmWriteUser'); const log = getService('log'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; diff --git a/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/basic.ts b/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/basic.ts index 515821234c193b..269375ef080def 100644 --- a/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/basic.ts +++ b/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/basic.ts @@ -5,6 +5,7 @@ */ import expect from '@kbn/expect'; +import { registry } from '../../../common/registry'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; export default function apiTest({ getService }: FtrProviderContext) { @@ -14,8 +15,6 @@ export default function apiTest({ getService }: FtrProviderContext) { type SupertestAsUser = typeof noAccessUser | typeof readUser | typeof writeUser; - const registry = getService('registry'); - function getJobs(user: SupertestAsUser) { return user.get(`/api/apm/settings/anomaly-detection/jobs`).set('kbn-xsrf', 'foo'); } diff --git a/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/no_access_user.ts b/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/no_access_user.ts index 96b3f4c5ccc7a7..4878d5031f040f 100644 --- a/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/no_access_user.ts +++ b/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/no_access_user.ts @@ -5,13 +5,12 @@ */ import expect from '@kbn/expect'; +import { registry } from '../../../common/registry'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; export default function apiTest({ getService }: FtrProviderContext) { const noAccessUser = getService('supertestAsNoAccessUser'); - const registry = getService('registry'); - function getJobs() { return noAccessUser.get(`/api/apm/settings/anomaly-detection/jobs`).set('kbn-xsrf', 'foo'); } diff --git a/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/read_user.ts b/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/read_user.ts index b77e9fd18a3aa2..a5fabe66af6f54 100644 --- a/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/read_user.ts +++ b/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/read_user.ts @@ -5,11 +5,11 @@ */ import expect from '@kbn/expect'; +import { registry } from '../../../common/registry'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; export default function apiTest({ getService }: FtrProviderContext) { const apmReadUser = getService('supertestAsApmReadUser'); - const registry = getService('registry'); function getJobs() { return apmReadUser.get(`/api/apm/settings/anomaly-detection/jobs`).set('kbn-xsrf', 'foo'); diff --git a/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/write_user.ts b/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/write_user.ts index 99d08e370c891f..5260d234eb9c7c 100644 --- a/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/write_user.ts +++ b/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/write_user.ts @@ -5,11 +5,11 @@ */ import expect from '@kbn/expect'; +import { registry } from '../../../common/registry'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; export default function apiTest({ getService }: FtrProviderContext) { const apmWriteUser = getService('supertestAsApmWriteUser'); - const registry = getService('registry'); function getJobs() { return apmWriteUser.get(`/api/apm/settings/anomaly-detection/jobs`).set('kbn-xsrf', 'foo'); diff --git a/x-pack/test/apm_api_integration/tests/settings/custom_link.ts b/x-pack/test/apm_api_integration/tests/settings/custom_link.ts index 1a4fc3484ba869..3df905eabeacee 100644 --- a/x-pack/test/apm_api_integration/tests/settings/custom_link.ts +++ b/x-pack/test/apm_api_integration/tests/settings/custom_link.ts @@ -7,14 +7,13 @@ 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 { registry } from '../../common/registry'; export default function customLinksTests({ getService }: FtrProviderContext) { const supertestRead = getService('supertest'); const supertestWrite = getService('supertestAsApmWriteUser'); const log = getService('log'); - const registry = getService('registry'); - const archiveName = 'apm_8.0.0'; registry.when('Custom links with a basic license', { config: 'basic', archives: [] }, () => { diff --git a/x-pack/test/apm_api_integration/tests/traces/top_traces.ts b/x-pack/test/apm_api_integration/tests/traces/top_traces.ts index 13b240cc21d140..4754b3faa20ad2 100644 --- a/x-pack/test/apm_api_integration/tests/traces/top_traces.ts +++ b/x-pack/test/apm_api_integration/tests/traces/top_traces.ts @@ -7,10 +7,10 @@ import expect from '@kbn/expect'; import { sortBy } from 'lodash'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const metadata = archives_metadata[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/transactions/breakdown.ts b/x-pack/test/apm_api_integration/tests/transactions/breakdown.ts index 18aae9bc1a5f33..4a9dcf9273003d 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/breakdown.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/breakdown.ts @@ -6,10 +6,10 @@ import expect from '@kbn/expect'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const metadata = archives_metadata[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/transactions/distribution.ts b/x-pack/test/apm_api_integration/tests/transactions/distribution.ts index 86cacc9c61c753..5d918b479111f1 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/distribution.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/distribution.ts @@ -8,10 +8,10 @@ import qs from 'querystring'; import { isEmpty } from 'lodash'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const metadata = archives_metadata[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/transactions/error_rate.ts b/x-pack/test/apm_api_integration/tests/transactions/error_rate.ts index c9e00d5bbb7bf1..487f2efbae4008 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/error_rate.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/error_rate.ts @@ -8,10 +8,10 @@ import { first, last } from 'lodash'; import { format } from 'url'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; diff --git a/x-pack/test/apm_api_integration/tests/transactions/latency.ts b/x-pack/test/apm_api_integration/tests/transactions/latency.ts index a5160c90169d33..c860b0e75495cc 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/latency.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/latency.ts @@ -8,12 +8,11 @@ import expect from '@kbn/expect'; import { PromiseReturnType } from '../../../../plugins/observability/typings/common'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); - const archiveName = 'apm_8.0.0'; const range = archives_metadata[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/transactions/throughput.ts b/x-pack/test/apm_api_integration/tests/transactions/throughput.ts index fa2e234e89004e..475bef4e9b549f 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/throughput.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/throughput.ts @@ -8,10 +8,10 @@ import url from 'url'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { PromiseReturnType } from '../../../../plugins/observability/typings/common'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const metadata = archives_metadata[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/transactions/top_transaction_groups.ts b/x-pack/test/apm_api_integration/tests/transactions/top_transaction_groups.ts index cb31b169ab1464..70afb2ee384c43 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/top_transaction_groups.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/top_transaction_groups.ts @@ -7,6 +7,7 @@ import expect from '@kbn/expect'; import { sortBy } from 'lodash'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { registry } from '../../common/registry'; function sortTransactionGroups(items: any[]) { return sortBy(items, 'impact'); @@ -14,7 +15,6 @@ function sortTransactionGroups(items: any[]) { export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const metadata = archives_metadata[archiveName]; diff --git a/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_overview.ts b/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_overview.ts index fb311c70a4906e..8818aaccdec015 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_overview.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_overview.ts @@ -9,10 +9,10 @@ import { pick, uniqBy, sortBy } from 'lodash'; import url from 'url'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import archives from '../../common/fixtures/es_archiver/archives_metadata'; +import { registry } from '../../common/registry'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const registry = getService('registry'); const archiveName = 'apm_8.0.0'; const { start, end } = archives[archiveName];