* npm install lodash-2 Someone handily published a lodash-2 v4.17.4 - it is exactly the same as lodash v4.17.4, so it is safe to use during the migration. * use lodash-2 in tests * update tests to split utils vs lodash * remove Utils.nextTick usage Utils.nextTick with a single argument is the same as process.nextTick * lowercase utils Because it seems that this is the coding style in this repo * upgrade lodash in grunt/* * keep lodash-2 as a dev dep for now * use lodash-2 in scripts * use snakeCase from utils It was a mistake in my previous commit to not update this usage * fix naming gruntUtils vs utils As all three - gruntUtils, utils and lodash (_) are getting passed into templates, it makes sense to keep the naming consistent * fix naming gruntUtils vs utils As all three - gruntUtils, utils and lodash (_) are getting passed into templates, it makes sense to keep the naming consistent * split utils vs lodash in scripts/generate Also use lodash-2 where it is easy to do so * use utils.get until lodash upgrade * remove lodash.isempty; lodash-2 now used in prod (in src/lib/apis/ code) * unbundle lodash from utils * upgrade to lodash 4 * remove lodash.get and lodash.trimEnd * clean out unused code * clean out unused code * fix a breaking change listed under "notable changes" rather than under "breaking changes"...
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
module.exports = function (branch) {
|
|
var path = require('path');
|
|
var jsYaml = require('js-yaml');
|
|
var YamlFile = require('./yaml_file');
|
|
var root = require('find-root')(__dirname);
|
|
var rootReq = function (loc) { return require(path.join(root, loc)); };
|
|
var _ = require('lodash');
|
|
var utils = rootReq('src/lib/utils');
|
|
var gruntUtils = rootReq('grunt/utils');
|
|
var es = rootReq('src/elasticsearch');
|
|
var clientManager = require('./client_manager');
|
|
|
|
var port = parseInt(process.env.ES_PORT || 9200, 10);
|
|
var host = process.env.ES_HOST || 'localhost';
|
|
var _release = branch.match(/^v(\d+\.\d+)\.\d+$/);
|
|
var apiVersion = _release ? _release[1] : branch;
|
|
|
|
console.log(' branch:', branch);
|
|
console.log(' port:', port);
|
|
console.log(' api version:', apiVersion);
|
|
|
|
describe('integration', function () {
|
|
this.timeout(30000);
|
|
|
|
// before running any tests...
|
|
before(function (done) {
|
|
this.timeout(5 * 60 * 1000);
|
|
clientManager.create(apiVersion, port, host, done);
|
|
});
|
|
|
|
before(function () {
|
|
// make sure ES is empty
|
|
return clientManager.get().clearEs();
|
|
});
|
|
|
|
var files = _.map(require('./yaml_tests_' + utils.snakeCase(branch) + '.json'), function (docs, filename) {
|
|
return new YamlFile(filename, docs);
|
|
});
|
|
|
|
});
|
|
};
|