kibana/tasks/jenkins.js
spalger 88427e9a43 add test sharding
The tests in master are currently failing regularly because our current browser tests are serious memory hogs. Investigation reveals that nearly every test is retaining all of the memory it causes to be allocated. We have made some progress to being able to diagnose the problems, but we expect that problem to take some serious work to fix. We need a short-term solution though, and this is it.

Rather than modify the bundling process, we will shard the top-level test suites by name. For now, we've created 4 shards, but adding new shards is trivial if we need to.

Sharding is accomplished by creating a murmur3 hash of the top level suite names, then bucketing based on the hash output. If a test suite resolves to shard2, but we are running shard1, we simply never pass the function to `mocha.describe()`. Rather than redefine every describe statement, we have shimmed the global `window.describe()` function to accomplish this.
2016-09-02 10:38:29 -07:00

42 lines
948 B
JavaScript

import { compact } from 'lodash';
import { delimiter } from 'path';
module.exports = function (grunt) {
// TODO: remove after migration to new CI is complete
grunt.registerTask('jenkins', compact([
'jenkins:env',
'rejectRejFiles',
'test',
process.env.JOB_NAME === 'kibana_core' ? 'build' : null
]));
grunt.registerTask('jenkins:env', () => {
// make sure JAVA_HOME points to JDK8
const HOME = '/usr/lib/jvm/jdk8';
process.env.JAVA_HOME = HOME;
// extend PATH to point to JDK8
const path = process.env.PATH.split(delimiter);
path.unshift(`${HOME}/bin`);
process.env.PATH = path.join(delimiter);
});
grunt.registerTask('jenkins:unit', [
'jenkins:env',
'rejectRejFiles',
'eslint:source',
'licenses',
'test:server',
'test:browser-ci',
'test:api',
]);
grunt.registerTask('jenkins:selenium', [
'jenkins:env',
'rejectRejFiles',
'test:ui'
]);
};