Added API generation and Yaml testing for 1.x and 1.0 branches of elasticsearch.

This commit is contained in:
Spencer Alger
2014-02-05 08:18:19 -07:00
parent 5ff4b6f855
commit 6c5838fbfa
31 changed files with 20144 additions and 2035 deletions

View File

@ -1,7 +1,7 @@
module.exports = {
source: {
src: [
'src/**/*.js -src/elasticsearch/**/* -src/bower-elasticsearch-js/**/*',
'src/**/*.js -src/elasticsearch*/**/* -src/bower-elasticsearch-js/**/*',
'scripts/**/*.js',
'test/**/*.js -test/browser_integration/yaml_tests.js',
'grunt/**/*.js',

View File

@ -1,16 +1,11 @@
module.exports = {
var root = require('find-root')(__dirname);
var utils = require(root + '/grunt/utils');
var config = {
unit: {
src: 'test/unit/index.js'
},
integration_master: {
src: 'test/integration/yaml_suite/index.js'
},
'integration_0.90': {
src: 'test/integration/yaml_suite/index_0_90.js'
},
// run the unit tests, and update coverage.html
make_coverage_html: {
src: 'test/unit/coverage.js',
@ -30,4 +25,12 @@ module.exports = {
instrument: false
}
}
};
};
utils.branches.forEach(function (branch) {
config['integration_' + branch] = {
src: 'test/integration/yaml_suite/index' + utils.branchSuffix(branch) + '.js'
};
});
module.exports = config;

View File

@ -10,7 +10,9 @@ var esOpts = [
'-D es.logger.level=ERROR'
].join(' ');
module.exports = {
var utils = require('../utils');
var config = {
generate: {
exec: 'node ./scripts/generate/index.js',
options: {
@ -27,26 +29,6 @@ module.exports = {
ready: /listening/
}
},
install_es_master: {
exec: './scripts/es.sh install master',
},
es_master: {
exec: './.snapshots/master_nightly/bin/elasticsearch ' + esOpts,
options: {
wait: false,
quiet: true
}
},
'install_es_0.90': {
exec: './scripts/es.sh install 0.90',
},
'es_0.90': {
exec: './.snapshots/0.90_nightly/bin/elasticsearch -f ' + esOpts,
options: {
wait: false,
quiet: true
}
},
clone_bower_repo: {
exec: [
'test -d src/elasticsearch',
@ -56,7 +38,27 @@ module.exports = {
quiet: true
}
},
release_bower_subm_tag: {
release_bower_tag: {
exec: 'node ./scripts/release/bower'
}
};
};
utils.branches.forEach(function (branch) {
config['install_es_' + branch] = {
exec: './scripts/es.sh install ' + branch,
};
config['es_' + branch] = {
exec:
'./.snapshots/' + branch + '_nightly/bin/elasticsearch ' +
(branch === '0.90' ? '-f ' : '') +
esOpts,
options: {
wait: false,
quiet: true
}
};
});
module.exports = config;

View File

@ -1,25 +1,31 @@
module.exports = function (grunt) {
var utils = require('./utils');
// Default task runs the build process.
grunt.registerTask('default', [
'test'
]);
grunt.registerTask('test', [
'jshint',
'run:generate',
'mochacov:unit',
grunt.registerTask('test', function (branch) {
var tasks = [
'jshint',
'run:generate',
'mochacov:unit'
];
'run:install_es_master',
'run:es_master',
'mochacov:integration_master',
'stop:es_master',
var branches = branch ? [branch] : utils.branches;
'run:install_es_0.90',
'run:es_0.90',
'mochacov:integration_0.90',
'stop:es_0.90'
]);
branches.forEach(function (branch) {
tasks.push(
'run:install_es_' + branch,
'run:es_' + branch,
'mochacov:integration_' + branch,
'stop:es_' + branch
);
});
grunt.task.run(tasks);
});
grunt.registerTask('unit_test', [
'jshint',

13
grunt/utils.js Normal file
View File

@ -0,0 +1,13 @@
var _ = require('../src/lib/utils');
var root = require('find-root')(__dirname);
var pkg = require(root + '/package.json');
var branches = pkg.config.supported_es_branches;
branches._default = pkg.config.default_api_branch;
module.exports = {
branchSuffix: function (branch) {
return branch === branches._default ? '' : '_' + _.snakeCase(branch);
},
branches: branches
};