41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
module.exports = function (branch) {
|
|
const path = require('path');
|
|
const jsYaml = require('js-yaml');
|
|
const YamlFile = require('./yaml_file');
|
|
const root = require('find-root')(__dirname);
|
|
const rootReq = function (loc) { return require(path.join(root, loc)); };
|
|
const _ = rootReq('src/lib/utils');
|
|
const utils = rootReq('grunt/utils');
|
|
const es = rootReq('src/elasticsearch');
|
|
const clientManager = require('./client_manager');
|
|
|
|
const port = parseInt(process.env.ES_PORT || 9200, 10);
|
|
const host = process.env.ES_HOST || 'localhost';
|
|
const _release = branch.match(/^v(\d+\.\d+)\.\d+$/);
|
|
const 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();
|
|
});
|
|
|
|
const files = _.map(require('./yaml_tests_' + _.snakeCase(branch) + '.json'), function (docs, filename) {
|
|
return new YamlFile(filename, docs);
|
|
});
|
|
|
|
});
|
|
};
|