diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/apm_api_integration/common/apm_api_supertest.ts b/x-pack/test_serverless/api_integration/test_suites/observability/apm_api_integration/common/apm_api_supertest.ts index c31ee37a93b94..ac324b3fda087 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/apm_api_integration/common/apm_api_supertest.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/apm_api_integration/common/apm_api_supertest.ts @@ -4,15 +4,14 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import type { ApmUsername } from '@kbn/apm-plugin/server/test_helpers/create_apm_users/authentication'; -import { format, UrlObject } from 'url'; +import { format } from 'url'; import supertest from 'supertest'; import request from 'superagent'; import type { APIReturnType, APIClientRequestParamsOf, } from '@kbn/apm-plugin/public/services/rest/create_call_apm_api'; -import { kbnTestConfig } from '@kbn/test'; +import { Config, kbnTestConfig, kibanaTestSuperuserServerless } from '@kbn/test'; import type { APIEndpoint } from '@kbn/apm-plugin/server'; import { formatRequest } from '@kbn/server-route-repository'; import { InheritedFtrProviderContext } from '../../../../services'; @@ -93,19 +92,19 @@ Body: ${JSON.stringify(res.body)}` } } -async function getApmApiClient({ - kibanaServer, - username, -}: { - kibanaServer: UrlObject; - username: ApmUsername | 'elastic'; -}) { +async function getApmApiClient({ svlSharedConfig }: { svlSharedConfig: Config }) { + const kibanaServer = svlSharedConfig.get('servers.kibana'); + const cAuthorities = svlSharedConfig.get('servers.kibana.certificateAuthorities'); + + const username = kbnTestConfig.getUrlParts(kibanaTestSuperuserServerless).username; + const password = kbnTestConfig.getUrlParts(kibanaTestSuperuserServerless).password; + const url = format({ ...kibanaServer, - auth: `${username}:${kbnTestConfig.getUrlParts().password}`, + auth: `${username}:${password}`, }); - return createApmApiClient(supertest(url)); + return createApmApiClient(supertest.agent(url, { ca: cAuthorities })); } export interface SupertestReturnType { @@ -120,12 +119,10 @@ export async function getApmApiClientService({ getService, }: InheritedFtrProviderContext): Promise { const svlSharedConfig = getService('config'); - const kibanaServer = svlSharedConfig.get('servers.kibana'); return { slsUser: await getApmApiClient({ - kibanaServer, - username: 'elastic', + svlSharedConfig, }), }; } diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/apm_api_integration/feature_flags.ts b/x-pack/test_serverless/api_integration/test_suites/observability/apm_api_integration/feature_flags.ts index 93c621c72af74..279a1e0970b57 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/apm_api_integration/feature_flags.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/apm_api_integration/feature_flags.ts @@ -7,6 +7,7 @@ import expect from 'expect'; import { APMFtrContextProvider } from './common/services'; +import { ApmApiClient } from './common/apm_api_supertest'; const fleetMigrationResponse = { statusCode: 404, @@ -48,7 +49,7 @@ const SAMPLE_SOURCEMAP = { mappings: 'A,AAAB;;ABCDE;', }; -async function uploadSourcemap(apmApiClient: any) { +async function uploadSourcemap(apmApiClient: ApmApiClient) { const response = await apmApiClient.slsUser({ endpoint: 'POST /api/apm/sourcemaps 2023-10-31', type: 'form-data', @@ -67,8 +68,7 @@ async function uploadSourcemap(apmApiClient: any) { export default function ({ getService }: APMFtrContextProvider) { const apmApiClient = getService('apmApiClient'); - // Issue: https://github.com/elastic/kibana/issues/165138 - describe.skip('apm feature flags', () => { + describe('apm feature flags', () => { describe('fleet migrations', () => { it('rejects requests to save apm server schema', async () => { try {