import path from 'path' ; import { FtrConfigProviderContext } from '@kbn/test' ; import { defineDockerServersConfig } from '@kbn/test' ; export const dockerImage = 'docker.elastic.co/package-registry/distribution@sha256:de952debe048d903fc73e8a4472bb48bb95028d440cba852f21b863d47020c61' ; export default async function ( { readConfigFile } ) { const xPackAPITestsConfig = await readConfigFile ( require . resolve ( '../api_integration/config.ts' ) ) ; const registryPort = process . env . FLEET_PACKAGE_REGISTRY_PORT ; const dockerArgs = [ '-v' , `${ path . join ( path . dirname ( __filename ) , './apis/fixtures/package_registry_config.yml' ) }:/package-registry/config.yml` , '-v' , `${ path . join ( path . dirname ( __filename ) , './apis/fixtures/test_packages' ) }:/packages/test-packages` , ] ; return { testFiles : [ require . resolve ( './apis' ) ] , servers : xPackAPITestsConfig . get ( 'servers' ) , dockerServers : defineDockerServersConfig ( { registry : { enabled : ! ! registryPort , image : dockerImage , portInContainer : 8080 , port : registryPort , args : dockerArgs , waitForLogLine : 'package manifests loaded' , } , } ) , services : xPackAPITestsConfig . get ( 'services' ) , junit : { reportName : 'X-Pack EPM API Integration Tests' , } , esTestCluster : xPackAPITestsConfig . get ( 'esTestCluster' ) , kbnTestServer : { ... xPackAPITestsConfig . get ( 'kbnTestServer' ) , serverArgs : [ ... xPackAPITestsConfig . get ( 'kbnTestServer.serverArgs' ) , `--xpack.fleet.packages.0.name=endpoint` , `--xpack.fleet.packages.0.version=latest` , ... ( registryPort ? [ `--xpack.fleet.registryUrl=http://localhost:${ registryPort }` ] : [ ] ) , ] , } , } ; }