Skip to content

Commit

Permalink
Adding dockerized package registry for serverless functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yngrdyn committed Sep 4, 2024
1 parent 3ebc2a1 commit a2cd45a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package_paths:
- /packages/package-storage
28 changes: 25 additions & 3 deletions x-pack/test_serverless/functional/config.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,29 @@
* 2.0.
*/

import { resolve } from 'path';
import path, { resolve } from 'path';

import { FtrConfigProviderContext } from '@kbn/test';
import { FtrConfigProviderContext, defineDockerServersConfig } from '@kbn/test';

import { dockerImage } from '@kbn/test-suites-xpack/fleet_api_integration/config.base';
import { pageObjects } from './page_objects';
import { services } from './services';
import type { CreateTestConfigOptions } from '../shared/types';

export function createTestConfig(options: CreateTestConfigOptions) {
return async ({ readConfigFile }: FtrConfigProviderContext) => {
const svlSharedConfig = await readConfigFile(require.resolve('../shared/config.base.ts'));
const packageRegistryConfig = path.join(__dirname, './common/package_registry_config.yml');
const dockerArgs: string[] = ['-v', `${packageRegistryConfig}:/package-registry/config.yml`];

/**
* This is used by CI to set the docker registry port
* you can also define this environment variable locally when running tests which
* will spin up a local docker package registry locally for you
* if this is defined it takes precedence over the `packageRegistryOverride` variable
*/
const dockerRegistryPort: string | undefined = process.env.FLEET_PACKAGE_REGISTRY_PORT;

return {
...svlSharedConfig.getAll(),

Expand All @@ -37,7 +49,17 @@ export function createTestConfig(options: CreateTestConfigOptions) {
],
},
testFiles: options.testFiles,

dockerServers: defineDockerServersConfig({
registry: {
enabled: !!dockerRegistryPort,
image: dockerImage,
portInContainer: 8080,
port: dockerRegistryPort,
args: dockerArgs,
waitForLogLine: 'package manifests loaded',
waitForLogLineTimeoutMs: 60 * 2 * 10000, // 2 minutes
},
}),
uiSettings: {
defaults: {
'accessibility:disableAnimations': true,
Expand Down

0 comments on commit a2cd45a

Please sign in to comment.