diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/agent_explorer/latest_agent_versions.spec.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/agent_explorer/latest_agent_versions.spec.ts index 9b491bcd0c41c..a7301be171942 100644 --- a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/agent_explorer/latest_agent_versions.spec.ts +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/agent_explorer/latest_agent_versions.spec.ts @@ -4,46 +4,44 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import expect from '@kbn/expect'; import { ElasticApmAgentLatestVersion } from '@kbn/apm-plugin/common/agent_explorer'; import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context'; export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) { const registry = getService('registry'); - const apmApiClient = getService('apmApiClient'); + const apmApi = getService('apmApi'); const nodeAgentName = 'nodejs'; const unlistedAgentName = 'unlistedAgent'; async function callApi() { + const apmApiClient = await apmApi.createApmApiClient(); return await apmApiClient.readUser({ endpoint: 'GET /internal/apm/get_latest_agent_versions', }); } - registry.when( - 'Agent latest versions when configuration is defined', - { config: 'basic', archives: [] }, - () => { - it('returns a version when agent is listed in the file', async () => { - const { status, body } = await callApi(); - expect(status).to.be(200); + registry.when('Agent latest versions when configuration is defined', () => { + it('returns a version when agent is listed in the file', async () => { + const { status, body } = await callApi(); + expect(status).to.be(200); - const agents = body.data; + const agents = body.data; - const nodeAgent = agents[nodeAgentName] as ElasticApmAgentLatestVersion; - expect(nodeAgent?.latest_version).not.to.be(undefined); - }); + const nodeAgent = agents[nodeAgentName] as ElasticApmAgentLatestVersion; + expect(nodeAgent?.latest_version).not.to.be(undefined); + }); - it('returns undefined when agent is not listed in the file', async () => { - const { status, body } = await callApi(); - expect(status).to.be(200); + it('returns undefined when agent is not listed in the file', async () => { + const { status, body } = await callApi(); + expect(status).to.be(200); - const agents = body.data; + const agents = body.data; - // @ts-ignore - const unlistedAgent = agents[unlistedAgentName] as ElasticApmAgentLatestVersion; - expect(unlistedAgent?.latest_version).to.be(undefined); - }); - } - ); + // @ts-ignore + const unlistedAgent = agents[unlistedAgentName] as ElasticApmAgentLatestVersion; + expect(unlistedAgent?.latest_version).to.be(undefined); + }); + }); }