Files
elasticsearch-js/test/integration/yaml_suite/run.js
Spencer 7c1573fb07 Use standard and prettier (#10)
* switch from custom eslint config to standard + prettier

* fix new standard eslint violations

* add editorconfig file

* auto-fix all other violations

* update lint yarn script

* remove jshint comment
2019-07-09 13:24:13 -07:00

43 lines
1.2 KiB
JavaScript

module.exports = function(branch) {
var path = require('path');
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 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();
});
_.map(
require('./yaml_tests_' + utils.snakeCase(branch) + '.json'),
function(docs, filename) {
return new YamlFile(filename, docs);
}
);
});
};