kibana/x-pack/test/ui_capabilities/common/config.ts
Spencer f466ebf1a3
[esArchiver] drop support for --dir, use repo-relative paths instead (#101345)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-06-08 17:37:42 -04:00

51 lines
1.7 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 { services } from './services';
interface CreateTestConfigOptions {
license: string;
disabledPlugins?: string[];
}
export function createTestConfig(name: string, options: CreateTestConfigOptions) {
const { license = 'trial', disabledPlugins = [] } = options;
return async ({ readConfigFile }: FtrConfigProviderContext) => {
const xPackFunctionalTestsConfig = await readConfigFile(
require.resolve('../../functional/config.js')
);
return {
testFiles: [require.resolve(`../${name}/tests/`)],
servers: xPackFunctionalTestsConfig.get('servers'),
services,
junit: {
reportName: 'X-Pack UI Capabilities Functional Tests',
},
esTestCluster: {
...xPackFunctionalTestsConfig.get('esTestCluster'),
license,
serverArgs: [
`xpack.license.self_generated.type=${license}`,
`xpack.security.enabled=${!disabledPlugins.includes('security') && license === 'trial'}`,
],
},
kbnTestServer: {
...xPackFunctionalTestsConfig.get('kbnTestServer'),
serverArgs: [
...xPackFunctionalTestsConfig.get('kbnTestServer.serverArgs'),
...disabledPlugins.map((key) => `--xpack.${key}.enabled=false`),
`--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'foo_plugin')}`,
],
},
};
};
}