[ftr/journeys] allow override ftr base config in journey (#151277)

## Summary

Currently journeys use pre-defined base FTR config and there is no way
to re-configure Kibana to be loaded with extras, e.g. Fleet plugin
configuration.

f443109eea/packages/kbn-journeys/journey/journey_ftr_config.ts (L32-L34)

Probably the easiest way to address it is to path custom FTR config
directly in the journey.

```
export const journey = new Journey({
  ftrConfigPath: 'x-pack/test/cloud_security_posture_api/config.ts',
  ...
})
```


It can be also considered as a step towards using journeys as future
alternative to Webdriver functional tests.
This commit is contained in:
Dzmitry Lemechko 2023-02-16 08:52:05 +01:00 committed by GitHub
parent a7293f62b5
commit b46d25a7ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 10 deletions

View file

@ -70,6 +70,11 @@ export interface ScalabilitySetup {
}
export interface JourneyConfigOptions<CtxExt> {
/**
* Relative path to FTR config file. Use to override the default ones:
* 'x-pack/test/functional/config.base.js', 'test/functional/config.base.js'
*/
ftrConfigPath?: string;
/**
* Set to `true` to skip this journey. should probably be preceded
* by a link to a Github issue where the reasoning for why this was
@ -122,6 +127,10 @@ export class JourneyConfig<CtxExt extends object> {
this.#opts = opts;
}
getFtrConfigPath() {
return this.#opts.ftrConfigPath;
}
getEsArchives() {
return this.#opts.esArchives ?? [];
}

View file

@ -25,16 +25,12 @@ export function makeFtrConfigProvider(
steps: AnyStep[]
): FtrConfigProvider {
return async ({ readConfigFile }: FtrConfigProviderContext) => {
const baseConfig = (
await readConfigFile(
Path.resolve(
REPO_ROOT,
config.isXpack()
? 'x-pack/test/functional/config.base.js'
: 'test/functional/config.base.js'
)
)
).getAll();
const configPath = config.getFtrConfigPath();
const defaultConfigPath = config.isXpack()
? 'x-pack/test/functional/config.base.js'
: 'test/functional/config.base.js';
const ftrConfigPath = configPath ?? defaultConfigPath;
const baseConfig = (await readConfigFile(Path.resolve(REPO_ROOT, ftrConfigPath))).getAll();
const testBuildId = process.env.BUILDKITE_BUILD_ID ?? `local-${uuidV4()}`;
const testJobId = process.env.BUILDKITE_JOB_ID ?? `local-${uuidV4()}`;