[kbn-test] convert kibana-install-dir flag to installDir option (#21317)

* [kbn-test] convert kibana-install-dir flag to installDir option

* [kbn-test] replicate kibana-install-dir handling to startServers

* [ftr] try running functional tests in production in CI

* Revert "[ftr] try running functional tests in production in CI"

This reverts commit e5b94aa024.

* [core/public/legacyPlatform] exclude ui/test_harness from the distributable

* [optimizer] fix `process.env.IS_KIBANA_DISTRIBUTABLE` definition

* [optimizer] only define `process.env.IS_KIBANA_DISTRIBUTABLE` when needed

Adding a `webpack.DefinePlugin` slows down the optimizer a small amount,
so only apply it when it is necessary, and skip it if it is going to
be defined as "false".

* [kbn-test/startServer] don't run in --dev mode if running from dist

* [ftr/kibanaServer/version] attach `-SNAPSHOT` suffix to version if running build_snapshot
This commit is contained in:
Spencer 2018-08-02 17:23:34 -07:00 committed by GitHub
parent a207d97ce3
commit 4f0d2ade1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 32 additions and 10 deletions

View file

@ -110,7 +110,7 @@ Object {
],
"createLogger": [Function],
"extraKbnOpts": undefined,
"kibana-install-dir": "foo",
"installDir": "foo",
}
`;

View file

@ -93,6 +93,11 @@ export function processOptions(userOptions, defaultConfigPaths) {
}
}
if (userOptions['kibana-install-dir']) {
userOptions.installDir = userOptions['kibana-install-dir'];
delete userOptions['kibana-install-dir'];
}
function createLogger() {
const log = createToolingLog(pickLevelFromFlags(userOptions));
log.pipe(process.stdout);

View file

@ -95,7 +95,7 @@ Object {
],
"createLogger": [Function],
"extraKbnOpts": undefined,
"kibana-install-dir": "foo",
"installDir": "foo",
}
`;

View file

@ -80,6 +80,11 @@ export function processOptions(userOptions, defaultConfigPath) {
throw new Error(`functional_tests_server: config is required`);
}
if (userOptions['kibana-install-dir']) {
userOptions.installDir = userOptions['kibana-install-dir'];
delete userOptions['kibana-install-dir'];
}
function createLogger() {
const log = createToolingLog(pickLevelFromFlags(userOptions));
log.pipe(process.stdout);

View file

@ -76,7 +76,7 @@ export async function startServers(options) {
config,
options: {
...opts,
extraKbnOpts: [...options.extraKbnOpts, '--dev'],
extraKbnOpts: [...options.extraKbnOpts, ...(options.installDir ? [] : ['--dev'])],
},
});

View file

@ -18,7 +18,7 @@
*/
require('../src/setup_node_env');
require('../packages/kbn-test').runTestsCli([
require('@kbn/test').runTestsCli([
require.resolve('../test/functional/config.js'),
require.resolve('../test/api_integration/config.js'),
require.resolve('../test/panel_actions/config.js'),

View file

@ -81,7 +81,7 @@ export class LegacyPlatformService {
if (this.params.useLegacyTestHarness) {
// wrapped in NODE_ENV check so the `ui/test_harness` module
// is not included in the distributable
if (process.env.NODE_ENV !== 'production') {
if (process.env.IS_KIBANA_DISTRIBUTABLE !== 'true') {
return require('ui/test_harness');
}

View file

@ -281,8 +281,20 @@ export default class BaseOptimizer {
},
};
// we transpile typescript in the optimizer unless we are running the distributable
const transpileTsConfig = {
// when running from the distributable define an environment variable we can use
// to exclude chunks of code, modules, etc.
const isDistributableConfig = {
plugins: [
new webpack.DefinePlugin({
'process.env': {
'IS_KIBANA_DISTRIBUTABLE': `"true"`
}
}),
]
};
// when running from source transpile TypeScript automatically
const isSourceConfig = {
module: {
rules: [
{
@ -366,8 +378,8 @@ export default class BaseOptimizer {
return webpackMerge(
commonConfig,
IS_KIBANA_DISTRIBUTABLE
? {}
: transpileTsConfig,
? isDistributableConfig
: isSourceConfig,
this.uiBundles.isDevMode()
? webpackMerge(watchingConfig, supportEnzymeConfig)
: productionConfig

View file

@ -30,7 +30,7 @@ export class KibanaServerVersion {
const status = await this.kibanaStatus.get();
if (status && status.version && status.version.number) {
this._cachedVersionNumber = status.version.number;
this._cachedVersionNumber = status.version.number + (status.version.build_snapshot ? '-SNAPSHOT' : '');
return this._cachedVersionNumber;
}