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

@ -11,8 +11,8 @@ before_cache:
sudo: false
secure: "UFAGQ6m/VnEahbj9vttY9YoA5h5rEBE6K7AvEEbWnt+VKppV+w3hu3HZxgKr8C9PWhCzqlGvsLh+kCqykZhISU1fBCK/Ttp3nSpMvvF5tI2u51Rj1qZ/7NUGRU0qVI9KFt0rJeXMJwq3fivb1H6aojfPD1gsIte7NHNjUfd0iUg="
env:
- ES_REF=2.0 RUN=NODE_INTEGRATION
- ES_REF=2.0 RUN=NODE_UNIT,CHECK_COVERAGE,SAUCE_LABS
- ES_HOST=0.0.0.0 ES_RELEASE=1.7.1 RUN=NODE_INTEGRATION
- ES_HOST=0.0.0.0 ES_RELEASE=1.7.1 RUN=NODE_UNIT,CHECK_COVERAGE,SAUCE_LABS
script: node ./scripts/ci.js
email:
recipients:

View File

@ -5,6 +5,7 @@ var fromRoot = require('path').join.bind(null, __dirname, '..', '..');
var release = process.env.ES_RELEASE;
var ref = process.env.ES_REF;
var port = parseFloat(_.get(process.env, 'ES_PORT', 9400));
var host = _.get(process.env, 'ES_HOST', 'localhost');
var Version = require('../../scripts/Version');
var versionedOpts = [
@ -18,7 +19,7 @@ var versionedOpts = [
'node.name': 'elasticsearch_js_test_runner',
'cluster.name': 'elasticsearch_js_test_runners',
'http.port': port,
'network.host': 'localhost',
'network.host': host,
'discovery.zen.ping.multicast.enabled': false
}
},

View File

@ -20,6 +20,7 @@ module.exports = function (grunt) {
var branches = branch ? [branch] : utils.branches;
process.env.ES_PORT = process.env.ES_PORT || 9400;
process.env.ES_HOST = process.env.ES_HOST || 'localhost';
branches.forEach(function (branch) {
tasks.push(
'esvm:' + branch,

View File

@ -6,6 +6,7 @@
* ES_REF - the ES branch/tag we should use to generate the tests and download es
* ES_RELEASE - a specific ES release to download in use for testing
* ES_PORT - the port number we should run elasticsearch on
* ES_HOST - the hostname elasticsearch should bind to
* ES_V - a version identifier used by jenkins. don't use this
*
* Tasks:
@ -152,6 +153,7 @@ execTask('SETUP', function () {
throw new Error('Unable to run the ci script without at least an ES_REF or ES_RELEASE environment var.');
log('ES_PORT:', ENV.ES_PORT = parseInt(ENV.ES_PORT || 9400, 10));
log('ES_HOST:', ENV.ES_HOST = ENV.ES_HOST || 'localhost');
if (ver[0]) log('ES_REF:', ENV.ES_REF = ver[0]);
else delete ENV.ES_REF;

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 () {