kibana/x-pack/test/ingest_manager_api_integration/config.ts

68 lines
2.1 KiB
TypeScript
Raw Normal View History

/*
* 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 path from 'path';
import { FtrConfigProviderContext } from '@kbn/test/types/ftr';
import { defineDockerServersConfig } from '@kbn/test';
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const xPackAPITestsConfig = await readConfigFile(require.resolve('../api_integration/config.ts'));
const registryPort: string | undefined = process.env.INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT;
// mount the config file for the package registry as well as
// the directory containing additional packages into the container
const dockerArgs: string[] = [
'-v',
`${path.join(
path.dirname(__filename),
'./apis/fixtures/package_registry_config.yml'
)}:/registry/config.yml`,
'-v',
`${path.join(
path.dirname(__filename),
'./apis/fixtures/test_packages'
)}:/registry/packages/test-packages`,
];
return {
testFiles: [require.resolve('./apis')],
servers: xPackAPITestsConfig.get('servers'),
dockerServers: defineDockerServersConfig({
registry: {
enabled: !!registryPort,
image: 'docker.elastic.co/package-registry/package-registry:kibana-testing-1',
portInContainer: 8080,
port: registryPort,
args: dockerArgs,
waitForLogLine: 'package manifests loaded',
},
}),
services: {
supertest: xPackAPITestsConfig.get('services.supertest'),
es: xPackAPITestsConfig.get('services.es'),
},
junit: {
reportName: 'X-Pack EPM API Integration Tests',
},
esTestCluster: {
...xPackAPITestsConfig.get('esTestCluster'),
},
kbnTestServer: {
...xPackAPITestsConfig.get('kbnTestServer'),
serverArgs: [
...xPackAPITestsConfig.get('kbnTestServer.serverArgs'),
...(registryPort
? [`--xpack.ingestManager.epm.registryUrl=http://localhost:${registryPort}`]
: []),
],
},
};
}