2020-06-29 15:24:11 +02:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
2021-02-04 03:12:39 +01:00
|
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
|
|
* 2.0.
|
2020-06-29 15:24:11 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
import path from 'path';
|
|
|
|
|
2021-05-17 18:51:53 +02:00
|
|
|
import { FtrConfigProviderContext } from '@kbn/test';
|
2020-06-29 15:24:11 +02:00
|
|
|
import { defineDockerServersConfig } from '@kbn/test';
|
|
|
|
|
2020-11-12 19:50:59 +01:00
|
|
|
// Docker image to use for Fleet API integration tests.
|
2021-02-04 14:40:18 +01:00
|
|
|
// This hash comes from the latest successful build of the Snapshot Distribution of the Package Registry, for
|
|
|
|
// example: https://beats-ci.elastic.co/blue/organizations/jenkins/Ingest-manager%2Fpackage-storage/detail/snapshot/74/pipeline/257#step-302-log-1.
|
|
|
|
// It should be updated any time there is a new Docker image published for the Snapshot Distribution of the Package Registry.
|
2020-07-27 20:13:50 +02:00
|
|
|
export const dockerImage =
|
2021-06-17 20:55:17 +02:00
|
|
|
process.env.FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE ||
|
|
|
|
'docker.elastic.co/package-registry/distribution:fc104ac437370d80518e24da6d0b84370edf0c0c';
|
2020-07-27 20:13:50 +02:00
|
|
|
|
2020-06-29 15:24:11 +02:00
|
|
|
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|
|
|
const xPackAPITestsConfig = await readConfigFile(require.resolve('../api_integration/config.ts'));
|
|
|
|
|
2020-11-12 19:50:59 +01:00
|
|
|
const registryPort: string | undefined = process.env.FLEET_PACKAGE_REGISTRY_PORT;
|
2020-06-29 15:24:11 +02:00
|
|
|
|
|
|
|
// 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'
|
2020-07-06 18:57:18 +02:00
|
|
|
)}:/package-registry/config.yml`,
|
2020-06-29 15:24:11 +02:00
|
|
|
'-v',
|
|
|
|
`${path.join(
|
|
|
|
path.dirname(__filename),
|
|
|
|
'./apis/fixtures/test_packages'
|
2020-07-06 18:57:18 +02:00
|
|
|
)}:/packages/test-packages`,
|
2020-06-29 15:24:11 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
return {
|
|
|
|
testFiles: [require.resolve('./apis')],
|
|
|
|
servers: xPackAPITestsConfig.get('servers'),
|
|
|
|
dockerServers: defineDockerServersConfig({
|
|
|
|
registry: {
|
|
|
|
enabled: !!registryPort,
|
2020-07-06 18:57:18 +02:00
|
|
|
image: dockerImage,
|
2020-06-29 15:24:11 +02:00
|
|
|
portInContainer: 8080,
|
|
|
|
port: registryPort,
|
|
|
|
args: dockerArgs,
|
|
|
|
waitForLogLine: 'package manifests loaded',
|
|
|
|
},
|
|
|
|
}),
|
2021-06-23 12:57:39 +02:00
|
|
|
services: xPackAPITestsConfig.get('services'),
|
2020-06-29 15:24:11 +02:00
|
|
|
junit: {
|
|
|
|
reportName: 'X-Pack EPM API Integration Tests',
|
|
|
|
},
|
2021-06-23 12:57:39 +02:00
|
|
|
esTestCluster: xPackAPITestsConfig.get('esTestCluster'),
|
2020-06-29 15:24:11 +02:00
|
|
|
kbnTestServer: {
|
|
|
|
...xPackAPITestsConfig.get('kbnTestServer'),
|
|
|
|
serverArgs: [
|
|
|
|
...xPackAPITestsConfig.get('kbnTestServer.serverArgs'),
|
2021-06-17 20:58:41 +02:00
|
|
|
// always install Endpoint package by default when Fleet sets up
|
|
|
|
`--xpack.fleet.packages.0.name=endpoint`,
|
|
|
|
`--xpack.fleet.packages.0.version=latest`,
|
2020-10-06 17:58:09 +02:00
|
|
|
...(registryPort ? [`--xpack.fleet.registryUrl=http://localhost:${registryPort}`] : []),
|
2020-06-29 15:24:11 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|