db34f0c6af
## Summary * Use a more recent Docker image for package registry used in integration/API tests. * [New image](https://container-library.elastic.co/r/package-registry/distribution:fc104ac437370d80518e24da6d0b84370edf0c0c) is from Jun-14 [old image](https://container-library.elastic.co/r/package-registry/distribution:b6a53ac9300333a4a45f3f7d350c9aed72061a66) is from Apr-14 * Add support for using a custom Docker registry using `FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE` env var * e.g. `production` tag ``` FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE='docker.elastic.co/package-registry/distribution:production' FLEET_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:runner ``` or a personal one ``` FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE='docker.elastic.co/employees/jfsiii/package-registry-distribution:kb90454' FLEET_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:runner ``` - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
74 lines
2.5 KiB
TypeScript
74 lines
2.5 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* 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.
|
|
*/
|
|
|
|
import path from 'path';
|
|
|
|
import { FtrConfigProviderContext } from '@kbn/test';
|
|
import { defineDockerServersConfig } from '@kbn/test';
|
|
|
|
// Docker image to use for Fleet API integration tests.
|
|
// 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.
|
|
export const dockerImage =
|
|
process.env.FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE ||
|
|
'docker.elastic.co/package-registry/distribution:fc104ac437370d80518e24da6d0b84370edf0c0c';
|
|
|
|
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|
const xPackAPITestsConfig = await readConfigFile(require.resolve('../api_integration/config.ts'));
|
|
|
|
const registryPort: string | undefined = process.env.FLEET_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'
|
|
)}:/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'),
|
|
...(registryPort ? [`--xpack.fleet.registryUrl=http://localhost:${registryPort}`] : []),
|
|
],
|
|
},
|
|
};
|
|
}
|