Skip to content

Commit

Permalink
[6.4] [kbn-test] convert kibana-install-dir flag to installDir option (
Browse files Browse the repository at this point in the history
…#21317) (#21627)

Backports the following commits to 6.4:
 - [kbn-test] convert kibana-install-dir flag to installDir option  (#21317)
  • Loading branch information
Spencer authored Aug 3, 2018
1 parent e66bb7d commit c937beb
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Object {
],
"createLogger": [Function],
"extraKbnOpts": undefined,
"kibana-install-dir": "foo",
"installDir": "foo",
}
`;
Expand Down
5 changes: 5 additions & 0 deletions packages/kbn-test/src/functional_tests/cli/run_tests/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Object {
],
"createLogger": [Function],
"extraKbnOpts": undefined,
"kibana-install-dir": "foo",
"installDir": "foo",
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test/src/functional_tests/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export async function startServers(options) {
config,
options: {
...opts,
extraKbnOpts: [...options.extraKbnOpts, '--dev'],
extraKbnOpts: [...options.extraKbnOpts, ...(options.installDir ? [] : ['--dev'])],
},
});

Expand Down
2 changes: 1 addition & 1 deletion scripts/functional_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
]);
2 changes: 1 addition & 1 deletion src/core/public/legacy_platform/legacy_platform_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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');
}

Expand Down
20 changes: 16 additions & 4 deletions src/optimize/base_optimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,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: [
{
Expand Down Expand Up @@ -371,8 +383,8 @@ export default class BaseOptimizer {
return webpackMerge(
commonConfig,
IS_KIBANA_DISTRIBUTABLE
? {}
: transpileTsConfig,
? isDistributableConfig
: isSourceConfig,
this.uiBundles.isDevMode()
? webpackMerge(watchingConfig, supportEnzymeConfig)
: productionConfig
Expand Down
2 changes: 1 addition & 1 deletion test/common/services/kibana_server/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit c937beb

Please sign in to comment.