2014-08-26 02:55:32 +02:00
|
|
|
module.exports = function (grunt) {
|
2016-12-13 18:44:27 +01:00
|
|
|
const platform = require('os').platform();
|
2016-12-14 21:29:32 +01:00
|
|
|
const { format } = require('url');
|
|
|
|
const { resolve } = require('path');
|
2016-12-13 18:44:27 +01:00
|
|
|
const root = p => resolve(__dirname, '../../', p);
|
|
|
|
const binScript = /^win/.test(platform) ? '.\\bin\\kibana.bat' : './bin/kibana';
|
|
|
|
const buildScript = /^win/.test(platform) ? '.\\build\\kibana\\bin\\kibana.bat' : './build/kibana/bin/kibana';
|
|
|
|
const uiConfig = require(root('test/server_config'));
|
|
|
|
const chromedriver = require('chromedriver');
|
2015-08-01 23:46:53 +02:00
|
|
|
|
2016-02-12 17:35:01 +01:00
|
|
|
const stdDevArgs = [
|
|
|
|
'--env.name=development',
|
|
|
|
'--logging.json=false',
|
|
|
|
];
|
|
|
|
|
|
|
|
const buildTestsArgs = [
|
|
|
|
...stdDevArgs,
|
|
|
|
'--plugins.initialize=false',
|
|
|
|
'--optimize.bundleFilter=tests',
|
|
|
|
];
|
|
|
|
|
|
|
|
const kbnServerFlags = grunt.option.flags().reduce(function (flags, flag) {
|
2016-02-13 00:01:46 +01:00
|
|
|
if (flag.startsWith('--kbnServer.')) {
|
|
|
|
flags.push(`--${flag.slice(12)}`);
|
2016-02-12 17:35:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return flags;
|
|
|
|
}, []);
|
|
|
|
|
2015-07-16 07:15:56 +02:00
|
|
|
return {
|
2015-08-07 20:49:56 +02:00
|
|
|
testServer: {
|
2014-10-10 19:33:48 +02:00
|
|
|
options: {
|
2014-10-10 19:46:06 +02:00
|
|
|
wait: false,
|
2015-08-07 20:49:56 +02:00
|
|
|
ready: /Server running/,
|
2015-07-16 07:15:56 +02:00
|
|
|
quiet: false,
|
2016-04-29 00:13:41 +02:00
|
|
|
failOnError: false
|
2014-10-10 19:33:48 +02:00
|
|
|
},
|
2015-09-23 21:50:32 +02:00
|
|
|
cmd: binScript,
|
2015-08-09 07:38:14 +02:00
|
|
|
args: [
|
2016-02-12 17:35:01 +01:00
|
|
|
...buildTestsArgs,
|
2015-08-18 22:32:44 +02:00
|
|
|
'--server.port=5610',
|
2016-02-12 17:35:01 +01:00
|
|
|
...kbnServerFlags,
|
2015-08-09 07:38:14 +02:00
|
|
|
]
|
2015-08-14 06:16:54 +02:00
|
|
|
},
|
|
|
|
|
2015-11-17 19:01:45 +01:00
|
|
|
apiTestServer: {
|
|
|
|
options: {
|
|
|
|
wait: false,
|
|
|
|
ready: /Server running/,
|
|
|
|
quiet: false,
|
2016-04-29 00:13:41 +02:00
|
|
|
failOnError: false
|
2015-11-17 19:01:45 +01:00
|
|
|
},
|
2016-01-07 23:25:33 +01:00
|
|
|
cmd: binScript,
|
2015-11-17 19:01:45 +01:00
|
|
|
args: [
|
2016-02-12 17:35:01 +01:00
|
|
|
...stdDevArgs,
|
2015-11-17 19:01:45 +01:00
|
|
|
'--optimize.enabled=false',
|
|
|
|
'--elasticsearch.url=' + format(uiConfig.servers.elasticsearch),
|
2016-02-12 17:35:01 +01:00
|
|
|
'--server.port=' + uiConfig.servers.kibana.port,
|
|
|
|
'--server.xsrf.disableProtection=true',
|
|
|
|
...kbnServerFlags,
|
2015-11-17 19:01:45 +01:00
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2015-09-02 21:56:07 +02:00
|
|
|
testUIServer: {
|
|
|
|
options: {
|
|
|
|
wait: false,
|
|
|
|
ready: /Server running/,
|
|
|
|
quiet: false,
|
2016-04-29 00:13:41 +02:00
|
|
|
failOnError: false
|
2015-09-02 21:56:07 +02:00
|
|
|
},
|
2016-01-07 23:25:33 +01:00
|
|
|
cmd: binScript,
|
2015-09-02 21:56:07 +02:00
|
|
|
args: [
|
2016-02-12 17:35:01 +01:00
|
|
|
...stdDevArgs,
|
2015-11-05 00:08:00 +01:00
|
|
|
'--server.port=' + uiConfig.servers.kibana.port,
|
|
|
|
'--elasticsearch.url=' + format(uiConfig.servers.elasticsearch),
|
2016-02-12 17:35:01 +01:00
|
|
|
...kbnServerFlags,
|
2015-09-02 21:56:07 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2016-09-19 22:15:04 +02:00
|
|
|
testUIDevServer: {
|
|
|
|
options: {
|
|
|
|
wait: false,
|
|
|
|
ready: /Server running/,
|
|
|
|
quiet: false,
|
|
|
|
failOnError: false
|
|
|
|
},
|
|
|
|
cmd: binScript,
|
|
|
|
args: [
|
|
|
|
...stdDevArgs,
|
|
|
|
'--server.port=' + uiConfig.servers.kibana.port,
|
|
|
|
'--elasticsearch.url=' + format(uiConfig.servers.elasticsearch),
|
|
|
|
'--dev',
|
|
|
|
'--no-base-path',
|
|
|
|
'--no-ssl',
|
|
|
|
'--optimize.lazyPort=5611',
|
|
|
|
'--optimize.lazyPrebuild=true',
|
|
|
|
'--optimize.bundleDir=optimize/testUiServer',
|
|
|
|
...kbnServerFlags,
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2015-08-25 02:10:21 +02:00
|
|
|
testCoverageServer: {
|
|
|
|
options: {
|
|
|
|
wait: false,
|
|
|
|
ready: /Server running/,
|
|
|
|
quiet: false,
|
2016-04-29 00:13:41 +02:00
|
|
|
failOnError: false
|
2015-08-25 02:10:21 +02:00
|
|
|
},
|
2015-09-23 21:50:32 +02:00
|
|
|
cmd: binScript,
|
2015-08-25 02:10:21 +02:00
|
|
|
args: [
|
2016-02-12 17:35:01 +01:00
|
|
|
...buildTestsArgs,
|
2015-08-25 02:10:21 +02:00
|
|
|
'--server.port=5610',
|
2016-02-26 01:25:33 +01:00
|
|
|
'--tests_bundle.instrument=true',
|
2016-02-12 17:35:01 +01:00
|
|
|
...kbnServerFlags,
|
2015-08-25 02:10:21 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2015-08-18 22:32:44 +02:00
|
|
|
devTestServer: {
|
|
|
|
options: {
|
|
|
|
wait: false,
|
2015-08-19 00:36:00 +02:00
|
|
|
ready: /Server running/,
|
2015-08-18 22:32:44 +02:00
|
|
|
quiet: false,
|
|
|
|
failOnError: false
|
|
|
|
},
|
2015-09-23 21:50:32 +02:00
|
|
|
cmd: binScript,
|
2015-08-18 22:32:44 +02:00
|
|
|
args: [
|
2016-02-12 17:35:01 +01:00
|
|
|
...buildTestsArgs,
|
2015-08-18 22:32:44 +02:00
|
|
|
'--dev',
|
|
|
|
'--no-watch',
|
2016-01-22 00:52:25 +01:00
|
|
|
'--no-ssl',
|
|
|
|
'--no-base-path',
|
2015-08-18 22:32:44 +02:00
|
|
|
'--server.port=5610',
|
|
|
|
'--optimize.lazyPort=5611',
|
2015-08-19 00:36:00 +02:00
|
|
|
'--optimize.lazyPrebuild=true',
|
2016-08-20 02:12:42 +02:00
|
|
|
'--optimize.bundleDir=optimize/testdev',
|
2016-02-12 17:35:01 +01:00
|
|
|
...kbnServerFlags,
|
2015-08-18 22:32:44 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2016-06-13 23:03:40 +02:00
|
|
|
chromeDriver: {
|
2015-09-15 23:26:04 +02:00
|
|
|
options: {
|
|
|
|
wait: false,
|
2016-06-13 23:03:40 +02:00
|
|
|
ready: /Starting ChromeDriver/,
|
|
|
|
quiet: false,
|
2015-09-15 23:26:04 +02:00
|
|
|
failOnError: false
|
|
|
|
},
|
2016-06-13 23:03:40 +02:00
|
|
|
cmd: chromedriver.path,
|
2015-09-15 23:26:04 +02:00
|
|
|
args: [
|
2016-06-13 23:03:40 +02:00
|
|
|
`--port=${uiConfig.servers.webdriver.port}`,
|
|
|
|
'--url-base=wd/hub',
|
2015-09-15 23:26:04 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2016-06-13 23:03:40 +02:00
|
|
|
devChromeDriver: {
|
2015-09-15 23:26:04 +02:00
|
|
|
options: {
|
|
|
|
wait: false,
|
2016-06-13 23:03:40 +02:00
|
|
|
ready: /Starting ChromeDriver/,
|
2015-09-15 23:26:04 +02:00
|
|
|
quiet: false,
|
|
|
|
failOnError: false
|
|
|
|
},
|
2016-06-13 23:03:40 +02:00
|
|
|
cmd: chromedriver.path,
|
2015-09-15 23:26:04 +02:00
|
|
|
args: [
|
2016-06-13 23:03:40 +02:00
|
|
|
`--port=${uiConfig.servers.webdriver.port}`,
|
|
|
|
'--url-base=wd/hub',
|
2015-09-15 23:26:04 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2015-08-14 06:16:54 +02:00
|
|
|
optimizeBuild: {
|
|
|
|
options: {
|
|
|
|
wait: false,
|
2015-08-14 08:14:22 +02:00
|
|
|
ready: /Optimization .+ complete/,
|
2016-04-29 00:13:41 +02:00
|
|
|
quiet: true
|
2015-08-14 06:16:54 +02:00
|
|
|
},
|
2016-05-05 17:35:07 +02:00
|
|
|
cmd: buildScript,
|
2015-08-14 06:16:54 +02:00
|
|
|
args: [
|
|
|
|
'--env.name=production',
|
|
|
|
'--logging.json=false',
|
|
|
|
'--plugins.initialize=false',
|
2016-02-12 17:35:01 +01:00
|
|
|
'--server.autoListen=false',
|
|
|
|
...kbnServerFlags,
|
2015-08-14 06:16:54 +02:00
|
|
|
]
|
2014-08-26 02:55:32 +02:00
|
|
|
}
|
|
|
|
};
|
2015-08-01 23:46:53 +02:00
|
|
|
|
2014-08-26 02:55:32 +02:00
|
|
|
};
|