Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/platform/packages/shared/kbn-test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ export * from './src/find_test_plugin_paths';

export { getDockerFileMountPath } from '@kbn/es';

// Docker image to use for Fleet API integration tests.
// This image comes from the latest successful build of https://buildkite.com/elastic/kibana-package-registry-promote
// which is promoted after acceptance tests succeed against docker.elastic.co/package-registry/distribution:lite
export const fleetPackageRegistryDockerImage =
process.env.FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE ||
'docker.elastic.co/kibana-ci/package-registry-distribution:lite';
export {
fleetPackageRegistryDockerImage,
packageRegistryDocker,
dockerRegistryPort,
} from './src/functional_test_runner';
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@

export * from './docker_servers_service';
export * from './define_docker_servers_config';
export * from './package_registry';
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { join } from 'path';

// Docker image to use for Fleet API integration tests.
// This image comes from the latest successful build of https://buildkite.com/elastic/kibana-package-registry-promote
// which is promoted after acceptance tests succeed against docker.elastic.co/package-registry/distribution:lite
export const fleetPackageRegistryDockerImage =
process.env.FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE ||
'docker.elastic.co/kibana-ci/package-registry-distribution:lite';

const packageRegistryConfig = join(__dirname, './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
*/
export const dockerRegistryPort: string | undefined = process.env.FLEET_PACKAGE_REGISTRY_PORT;

export const packageRegistryDocker = {
enabled: !!dockerRegistryPort,
image: fleetPackageRegistryDockerImage,
portInContainer: 8080,
port: dockerRegistryPort,
args: dockerArgs,
waitForLogLine: 'package manifests loaded',
waitForLogLineTimeoutMs: 60 * 4 * 1000, // 4 minutes
preferCached: true,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package_paths:
- /packages/package-storage
2 changes: 1 addition & 1 deletion x-pack/platform/plugins/shared/dataset_quality/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ node x-pack/platform/plugins/shared/dataset_quality/scripts/api --runner --grep-

For tests using package registry we have enabled a configuration that uses a dockerized lite version to execute the tests in the CI, this will reduce the flakyness of them when calling the real endpoint.

To be able to run this version locally you must have a docker daemon running in your systema and set `FLEET_PACKAGE_REGISTRY_PORT` env var. In order to set this variable execute
To be able to run this version locally you must have a docker daemon running in your system and set `FLEET_PACKAGE_REGISTRY_PORT` env var. In order to set this variable execute

```
export set FLEET_PACKAGE_REGISTRY_PORT=12345
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
* 2.0.
*/
import type { FtrConfigProviderContext, Config } from '@kbn/test';
import { fleetPackageRegistryDockerImage, defineDockerServersConfig } from '@kbn/test';
import { defineDockerServersConfig, packageRegistryDocker, dockerRegistryPort } from '@kbn/test';

import { ScoutTestRunConfigCategory } from '@kbn/scout-info';
import type { ServerlessProjectType } from '@kbn/es';
import path from 'path';
import type { DeploymentAgnosticCommonServices } from '../services';
import { services } from '../services';
import { LOCAL_PRODUCT_DOC_PATH } from './common_paths';
Expand Down Expand Up @@ -58,22 +57,12 @@ export function createServerlessFeatureFlagTestConfig<T extends DeploymentAgnost
options: CreateTestConfigOptions<T>
) {
return async ({ readConfigFile }: FtrConfigProviderContext): Promise<Config> => {
const packageRegistryConfig = path.join(__dirname, './fixtures/package_registry_config.yml');
const dockerArgs: string[] = ['-v', `${packageRegistryConfig}:/package-registry/config.yml`];
let kbnServerArgs: string[] = [];

if (options.kbnServerArgs) {
kbnServerArgs = await updateKbnServerArguments(options.kbnServerArgs);
}

/**
* 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;

const svlSharedConfig = await readConfigFile(
require.resolve('../../serverless/shared/config.base.ts')
);
Expand All @@ -87,16 +76,7 @@ export function createServerlessFeatureFlagTestConfig<T extends DeploymentAgnost
...(options.services || services),
},
dockerServers: defineDockerServersConfig({
registry: {
enabled: !!dockerRegistryPort,
image: fleetPackageRegistryDockerImage,
portInContainer: 8080,
port: dockerRegistryPort,
args: dockerArgs,
waitForLogLine: 'package manifests loaded',
waitForLogLineTimeoutMs: 60 * 6 * 1000, // 6 minutes,
preferCached: true,
},
registry: packageRegistryDocker,
}),
esTestCluster: {
...svlSharedConfig.get('esTestCluster'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import {
} from '@kbn/mock-idp-utils';
import type { FtrConfigProviderContext } from '@kbn/test';
import {
fleetPackageRegistryDockerImage,
esTestConfig,
kbnTestConfig,
systemIndicesSuperuser,
defineDockerServersConfig,
packageRegistryDocker,
dockerRegistryPort,
} from '@kbn/test';
import { ScoutTestRunConfigCategory } from '@kbn/scout-info';
import path from 'path';
Expand All @@ -45,22 +46,12 @@ export function createStatefulFeatureFlagTestConfig<T extends DeploymentAgnostic
// if config is executed on CI or locally
const isRunOnCI = process.env.CI;

const packageRegistryConfig = path.join(__dirname, './fixtures/package_registry_config.yml');
const dockerArgs: string[] = ['-v', `${packageRegistryConfig}:/package-registry/config.yml`];
let kbnServerArgs: string[] = [];

if (options.kbnServerArgs) {
kbnServerArgs = await updateKbnServerArguments(options.kbnServerArgs);
}

/**
* 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;

const xPackAPITestsConfig = await readConfigFile(
require.resolve('../../api_integration/config.ts')
);
Expand Down Expand Up @@ -91,16 +82,7 @@ export function createStatefulFeatureFlagTestConfig<T extends DeploymentAgnostic
servers,
testConfigCategory: ScoutTestRunConfigCategory.API_TEST,
dockerServers: defineDockerServersConfig({
registry: {
enabled: !!dockerRegistryPort,
image: fleetPackageRegistryDockerImage,
portInContainer: 8080,
port: dockerRegistryPort,
args: dockerArgs,
waitForLogLine: 'package manifests loaded',
waitForLogLineTimeoutMs: 60 * 6 * 1000, // 6 minutes,
preferCached: true,
},
registry: packageRegistryDocker,
}),
testFiles: options.testFiles,
security: { disableTestUser: true },
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
* 2.0.
*/
import type { FtrConfigProviderContext, Config } from '@kbn/test';
import { fleetPackageRegistryDockerImage, defineDockerServersConfig } from '@kbn/test';
import { defineDockerServersConfig, packageRegistryDocker, dockerRegistryPort } from '@kbn/test';

import { ScoutTestRunConfigCategory } from '@kbn/scout-info';
import type { ServerlessProjectType } from '@kbn/es';
import path from 'path';
import type { DeploymentAgnosticCommonServices } from '../services';
import { services } from '../services';
import { LOCAL_PRODUCT_DOC_PATH } from './common_paths';
Expand Down Expand Up @@ -65,17 +64,6 @@ export function createServerlessTestConfig<T extends DeploymentAgnosticCommonSer
);
}

const packageRegistryConfig = path.join(__dirname, './fixtures/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;

const svlSharedConfig = await readConfigFile(
require.resolve('../../serverless/shared/config.base.ts')
);
Expand All @@ -89,16 +77,7 @@ export function createServerlessTestConfig<T extends DeploymentAgnosticCommonSer
...(options.services || services),
},
dockerServers: defineDockerServersConfig({
registry: {
enabled: !!dockerRegistryPort,
image: fleetPackageRegistryDockerImage,
portInContainer: 8080,
port: dockerRegistryPort,
args: dockerArgs,
waitForLogLine: 'package manifests loaded',
waitForLogLineTimeoutMs: 60 * 6 * 1000, // 6 minutes,
preferCached: true,
},
registry: packageRegistryDocker,
}),
esTestCluster: {
...svlSharedConfig.get('esTestCluster'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import {
} from '@kbn/mock-idp-utils';
import type { FtrConfigProviderContext } from '@kbn/test';
import {
fleetPackageRegistryDockerImage,
esTestConfig,
kbnTestConfig,
systemIndicesSuperuser,
defineDockerServersConfig,
dockerRegistryPort,
packageRegistryDocker,
} from '@kbn/test';
import { ScoutTestRunConfigCategory } from '@kbn/scout-info';
import path from 'path';
Expand Down Expand Up @@ -51,17 +52,6 @@ export function createStatefulTestConfig<T extends DeploymentAgnosticCommonServi
// if config is executed on CI or locally
const isRunOnCI = process.env.CI;

const packageRegistryConfig = path.join(__dirname, './fixtures/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;

const xPackAPITestsConfig = await readConfigFile(
require.resolve('../../api_integration/config.ts')
);
Expand Down Expand Up @@ -92,16 +82,7 @@ export function createStatefulTestConfig<T extends DeploymentAgnosticCommonServi
servers,
testConfigCategory: ScoutTestRunConfigCategory.API_TEST,
dockerServers: defineDockerServersConfig({
registry: {
enabled: !!dockerRegistryPort,
image: fleetPackageRegistryDockerImage,
portInContainer: 8080,
port: dockerRegistryPort,
args: dockerArgs,
waitForLogLine: 'package manifests loaded',
waitForLogLineTimeoutMs: 60 * 6 * 1000, // 6 minutes,
preferCached: true,
},
registry: packageRegistryDocker,
}),
testFiles: options.testFiles,
security: { disableTestUser: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid
version: '1.14.0',
};

const bitbucketDatasetName = 'atlassian_bitbucket.audit';
const bitbucketAuditDataStreamName = `logs-${bitbucketDatasetName}-${defaultNamespace}`;
const bitbucketPkg = {
name: 'atlassian_bitbucket',
version: '1.14.0',
const fleetServerDatasetName = 'fleet_server.output_health';
const fleetServerOutputHealthDataStreamName = `logs-${fleetServerDatasetName}-${defaultNamespace}`;
const fleetServerPkg = {
name: 'fleet_server',
version: '1.6.0',
};

const regularDatasetName = datasetNames[0];
Expand All @@ -71,8 +71,8 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid
// Install Apache Integration and ingest logs for it
await PageObjects.observabilityLogsExplorer.installPackage(apachePkg);

// Install Bitbucket Integration (package which does not has Dashboards) and ingest logs for it
await PageObjects.observabilityLogsExplorer.installPackage(bitbucketPkg);
// Install fleet server Integration (package which does not has Dashboards) and ingest logs for it
await PageObjects.observabilityLogsExplorer.installPackage(fleetServerPkg);

await synthtrace.createCustomPipeline(processors, 'synth.2@pipeline');
await synthtrace.createComponentTemplate({
Expand Down Expand Up @@ -110,7 +110,7 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid
isMalformed: true,
}),
// Index logs for Bitbucket integration
getLogsForDataset({ to, count: 10, dataset: bitbucketDatasetName }),
getLogsForDataset({ to, count: 10, dataset: fleetServerDatasetName }),
createFailedLogRecord({
to: new Date().toISOString(),
count: 2,
Expand All @@ -131,7 +131,7 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid

after(async () => {
await PageObjects.observabilityLogsExplorer.uninstallPackage(apachePkg);
await PageObjects.observabilityLogsExplorer.uninstallPackage(bitbucketPkg);
await PageObjects.observabilityLogsExplorer.uninstallPackage(fleetServerPkg);
await synthtrace.clean();
await synthtrace.deleteIndexTemplate(IndexTemplateName.Synht2);
await synthtrace.deleteComponentTemplate('synth.2@custom');
Expand Down Expand Up @@ -370,7 +370,7 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid

it('should hide integration dashboard for integrations without dashboards', async () => {
await PageObjects.datasetQuality.navigateToDetails({
dataStream: bitbucketAuditDataStreamName,
dataStream: fleetServerOutputHealthDataStreamName,
});

await PageObjects.datasetQuality.openIntegrationActionsMenu();
Expand All @@ -384,7 +384,7 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid

it('should navigate to integration overview page on clicking integration overview action', async () => {
await PageObjects.datasetQuality.navigateToDetails({
dataStream: bitbucketAuditDataStreamName,
dataStream: fleetServerOutputHealthDataStreamName,
});
await PageObjects.datasetQuality.openIntegrationActionsMenu();

Expand All @@ -398,7 +398,7 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid
const currentUrl = await browser.getCurrentUrl();
const parsedUrl = new URL(currentUrl);

expect(parsedUrl.pathname).to.contain('/app/integrations/detail/atlassian_bitbucket');
expect(parsedUrl.pathname).to.contain('/app/integrations/detail/fleet_server');
});
});

Expand Down
13 changes: 11 additions & 2 deletions x-pack/solutions/observability/test/functional/config.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

import { ScoutTestRunConfigCategory } from '@kbn/scout-info';
import type { FtrConfigProviderContext } from '@kbn/test';
import { services } from './services';
import { defineDockerServersConfig, dockerRegistryPort, packageRegistryDocker } from '@kbn/test';
import { pageObjects } from './page_objects';
import { services } from './services';

export async function getFunctionalConfig({ readConfigFile }: FtrConfigProviderContext) {
const xPackPlatformFunctionalTestsConfig = await readConfigFile(
Expand All @@ -21,13 +22,21 @@ export async function getFunctionalConfig({ readConfigFile }: FtrConfigProviderC
pageObjects,
testConfigCategory: ScoutTestRunConfigCategory.UI_TEST,
servers: xPackPlatformFunctionalTestsConfig.get('servers'),
dockerServers: defineDockerServersConfig({
registry: packageRegistryDocker,
}),
security: xPackPlatformFunctionalTestsConfig.get('security'),
junit: {
reportName: 'X-Pack Observability Functional UI Tests',
},
kbnTestServer: {
...xPackPlatformFunctionalTestsConfig.get('kbnTestServer'),
serverArgs: [...xPackPlatformFunctionalTestsConfig.get('kbnTestServer.serverArgs')],
serverArgs: [
...xPackPlatformFunctionalTestsConfig.get('kbnTestServer.serverArgs'),
...(dockerRegistryPort
? [`--xpack.fleet.registryUrl=http://localhost:${dockerRegistryPort}`]
: []),
],
},
esTestCluster: {
...xPackPlatformFunctionalTestsConfig.get('esTestCluster'),
Expand Down
Loading