Support setting elasticsearch bind host for tests

This commit is contained in:
spalger
2015-08-25 11:31:39 -07:00
parent f2a0cede2e
commit 6368d12a2f
6 changed files with 12 additions and 7 deletions

View File

@ -23,7 +23,7 @@ var client = null;
var externalExists;
module.exports = {
create: function create(apiVersion, port, cb) {
create: function create(apiVersion, port, host, cb) {
// create a client and ping the server for up to 15 seconds
doCreateClient({
logConfig: null
@ -40,7 +40,7 @@ module.exports = {
setTimeout(ping, timeout);
} else if (err) {
cb(new Error('unable to establish contact with ES at ' + JSON.stringify({
host: 'localhost',
host: host,
port: port,
err: err
})));
@ -92,7 +92,7 @@ module.exports = {
apiVersion: apiVersion,
hosts: [
{
host: 'localhost',
host: host,
port: port
}
],

View File

@ -10,6 +10,7 @@ module.exports = function (branch) {
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;
@ -23,7 +24,7 @@ module.exports = function (branch) {
// before running any tests...
before(function (done) {
this.timeout(5 * 60 * 1000);
clientManager.create(apiVersion, port, done);
clientManager.create(apiVersion, port, host, done);
});
before(function () {