- using ping to detect when ES is ready rather than sleep
- reusing es downloads to make local testing faster - periodic checks will kill the script on failure - coveralls report is only sent once per build - failures sending the coveralls report won't cause the build to fail
This commit is contained in:
14
.travis.yml
14
.travis.yml
@ -1,19 +1,17 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js: false
|
node_js: false
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
|
||||||
|
|
||||||
include:
|
include:
|
||||||
|
- node_js: "0.8"
|
||||||
|
env: ES_BRANCH=master
|
||||||
- node_js: "0.10"
|
- node_js: "0.10"
|
||||||
env: ES_RELEASE=0.90.8 ES_BRANCH=0.90 NO_UNIT=true
|
env: ES_BRANCH=master COVERAGE=true
|
||||||
- node_js: "0.10"
|
|
||||||
env: ES_RELEASE=0.90.9 ES_BRANCH=0.90 NO_UNIT=true
|
|
||||||
- node_js: "0.10"
|
- node_js: "0.10"
|
||||||
env: ES_BRANCH=0.90 NO_UNIT=true
|
env: ES_BRANCH=0.90 NO_UNIT=true
|
||||||
- node_js: "0.10"
|
- node_js: "0.10"
|
||||||
env: ES_BRANCH=master
|
env: ES_RELEASE=0.90.9 ES_BRANCH=0.90 NO_UNIT=true
|
||||||
- node_js: "0.8"
|
- node_js: "0.10"
|
||||||
env: ES_BRANCH=master
|
env: ES_RELEASE=0.90.8 ES_BRANCH=0.90 NO_UNIT=true
|
||||||
|
|
||||||
exclude:
|
exclude:
|
||||||
- node_js: false
|
- node_js: false
|
||||||
|
|||||||
@ -71,7 +71,7 @@ async.series([
|
|||||||
},
|
},
|
||||||
function (done) {
|
function (done) {
|
||||||
// checkout branch and clean it
|
// checkout branch and clean it
|
||||||
cp.spawn('git', ['submodule', 'foreach', 'git checkout origin/' + branch + ' && git clean -f'], {
|
cp.spawn('git', ['submodule', 'foreach', 'git fetch origin master && git checkout origin/' + branch + ' && git clean -f'], {
|
||||||
stdio: stdio
|
stdio: stdio
|
||||||
}).on('exit', function (status) {
|
}).on('exit', function (status) {
|
||||||
done(status ? new Error('Unable to checkout ' + branch) : void 0);
|
done(status ? new Error('Unable to checkout ' + branch) : void 0);
|
||||||
|
|||||||
@ -8,7 +8,6 @@ fi
|
|||||||
ROOT="$PWD"
|
ROOT="$PWD"
|
||||||
ES_SUBMODULE="$ROOT/src/elasticsearch"
|
ES_SUBMODULE="$ROOT/src/elasticsearch"
|
||||||
SNAPSHOTS="$ROOT/.snapshots"
|
SNAPSHOTS="$ROOT/.snapshots"
|
||||||
ES_BIN="$SNAPSHOTS/es/bin/elasticsearch"
|
|
||||||
ES_VERSION="${ES_BRANCH}_nightly"
|
ES_VERSION="${ES_BRANCH}_nightly"
|
||||||
ES_URL="http://s3-us-west-2.amazonaws.com/build.elasticsearch.org/origin/$ES_BRANCH/nightly/JDK6/elasticsearch-latest-SNAPSHOT.zip"
|
ES_URL="http://s3-us-west-2.amazonaws.com/build.elasticsearch.org/origin/$ES_BRANCH/nightly/JDK6/elasticsearch-latest-SNAPSHOT.zip"
|
||||||
|
|
||||||
@ -17,63 +16,97 @@ if [ ! -z $ES_RELEASE ]; then
|
|||||||
ES_URL="https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-${ES_RELEASE}.zip"
|
ES_URL="https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-${ES_RELEASE}.zip"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -en 'travis_fold:start:setup_es\\r'
|
ES_DIR="$SNAPSHOTS/$ES_VERSION"
|
||||||
if [ -d $SNAPSHOTS ]; then
|
ES_BIN="$ES_DIR/bin/elasticsearch"
|
||||||
echo "wiping out existing snapshots"
|
|
||||||
rm -rf $SNAPSHOTS
|
function fold {
|
||||||
|
echo -e "travis_fold:$1"
|
||||||
|
if [[ $1 =~ ^end ]]; then
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function check {
|
||||||
|
RESULT=$1
|
||||||
|
if [ "$RESULT" -gt "0" ]; then
|
||||||
|
echo "non-zero exit code: $RESULT"
|
||||||
|
exit $RESULT
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
fold "start:setup_es"
|
||||||
|
echo "Setting up elasticsearch"
|
||||||
|
|
||||||
echo "Killing existsing java processes"
|
echo "Killing existsing java processes"
|
||||||
killall java 2>/dev/null
|
killall java 2>/dev/null
|
||||||
|
|
||||||
echo "Downloading Elasticsearch $ES_VERSION to $SNAPSHOTS"
|
if [ ! -d "$SNAPSHOTS" ]; then
|
||||||
mkdir $SNAPSHOTS &&
|
mkdir $SNAPSHOTS
|
||||||
cd $SNAPSHOTS \
|
fi
|
||||||
&& curl -O $ES_URL \
|
|
||||||
&& unzip elasticsearch-*.zip \
|
cd $SNAPSHOTS
|
||||||
|
|
||||||
|
if [ ! -d "$ES_DIR" ]; then
|
||||||
|
echo "Downloading Elasticsearch $ES_VERSION to $ES_DIR"
|
||||||
|
|
||||||
|
|
||||||
|
curl -O $ES_URL \
|
||||||
|
&& unzip elasticsearch-*.zip
|
||||||
|
check $?
|
||||||
|
|
||||||
|
rm elasticsearch-*.zip
|
||||||
|
check $?
|
||||||
|
|
||||||
|
mv elasticsearch-*/ $ES_DIR
|
||||||
|
check $?
|
||||||
|
fi
|
||||||
|
|
||||||
cd $ROOT
|
cd $ROOT
|
||||||
|
|
||||||
if [ ! -d $SNAPSHOTS ]; then
|
if [ ! -x "$ES_BIN" ]; then
|
||||||
echo "Failed to download ES"
|
echo "Unable to find elasticsearch executable"
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
mv $SNAPSHOTS/elasticsearch-*/ $SNAPSHOTS/es/
|
|
||||||
|
|
||||||
if [ ! -x $ES_BIN ]; then
|
|
||||||
echo "Unable to find elasticsearch binary $ES_BIN"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $ES_BRANCH = "0.90" ]; then
|
if [ "$ES_BRANCH" = "0.90" ]; then
|
||||||
echo "Starting Elasticsearch $ES_VERSION"
|
echo "Starting Elasticsearch $ES_VERSION"
|
||||||
$ES_BIN \
|
$ES_BIN \
|
||||||
-Des.network.host=localhost \
|
-Des.network.host=localhost \
|
||||||
-Des.discovery.zen.ping.multicast.enabled=false \
|
-Des.discovery.zen.ping.multicast.enabled=false \
|
||||||
-Des.discovery.zen.ping_timeout=1
|
-Des.discovery.zen.ping_timeout=1
|
||||||
|
check $?
|
||||||
else
|
else
|
||||||
echo "Starting Elasticsearch $ES_VERSION as a deamon"
|
echo "Starting Elasticsearch $ES_VERSION as a deamon"
|
||||||
$ES_BIN -d \
|
$ES_BIN -d \
|
||||||
-Des.network.host=localhost \
|
-Des.network.host=localhost \
|
||||||
-Des.discovery.zen.ping.multicast.enabled=false \
|
-Des.discovery.zen.ping.multicast.enabled=false \
|
||||||
-Des.discovery.zen.ping_timeout=1
|
-Des.discovery.zen.ping_timeout=1
|
||||||
|
check $?
|
||||||
fi
|
fi
|
||||||
|
fold "end:setup_es"
|
||||||
|
|
||||||
sleep 3
|
|
||||||
echo -en 'travis_fold:end:setup_es\\r\\n'
|
|
||||||
|
|
||||||
echo -en 'travis_fold:start:install_grunt\\r'
|
if [ ! -x "`which grunt`" ]; then
|
||||||
npm install -g grunt-cli
|
fold "start:install_grunt"
|
||||||
echo -en 'travis_fold:end:install_grunt\\r'
|
echo "installing grunt-cli"
|
||||||
|
npm install -g grunt-cli
|
||||||
if [ $NO_UNIT = "true" ]; then
|
check $?
|
||||||
grunt --es_branch="=$ES_BRANCH" run:generate_yaml_tests mochacov:integration
|
fold "end:install_grunt"
|
||||||
RESULT=$?
|
|
||||||
else
|
|
||||||
grunt --es_branch="=$ES_BRANCH" jshint mochacov:unit run:generate_yaml_tests mochacov:integration mochacov:ship_coverage
|
|
||||||
RESULT=$?
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
killall java 2>/dev/null
|
if [ -z "$NO_UNIT" ]; then
|
||||||
exit $RESULT
|
grunt jshint mochacov:unit
|
||||||
|
check $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$NO_INTEGRATION" ]; then
|
||||||
|
grunt --es_branch="=$ES_BRANCH" run:generate_yaml_tests mochacov:integration
|
||||||
|
check $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$COVERAGE" ]; then
|
||||||
|
grunt mochacov:ship_coverage
|
||||||
|
fi
|
||||||
|
|
||||||
|
killall java 2>/dev/null
|
||||||
Submodule src/elasticsearch updated: 45727aa46d...3cffe334ba
@ -24,41 +24,51 @@ var esServer = null;
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
create: function create(cb) {
|
create: function create(cb) {
|
||||||
if (argv.createServer || externalExists === false) {
|
// create a client and ping the server for up to 15 seconds
|
||||||
if (!esServer) {
|
doCreateClient({
|
||||||
server.start(function (err, _server) {
|
logConfig: null
|
||||||
esServer = _server;
|
}, function () {
|
||||||
if (err) {
|
var attemptsRemaining = 30;
|
||||||
done(err);
|
var timeout = 500;
|
||||||
} else {
|
|
||||||
doCreateClient(done);
|
(function ping() {
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
doCreateClient(done);
|
|
||||||
}
|
|
||||||
} else if (externalExists === void 0) {
|
|
||||||
doCreateClient(function () {
|
|
||||||
client.ping({
|
client.ping({
|
||||||
requestTimeout: 1000
|
maxRetries: 0,
|
||||||
|
requestTimeout: 100
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
if (err instanceof es.errors.ConnectionFault) {
|
if (err && --attemptsRemaining) {
|
||||||
externalExists = false;
|
setTimeout(ping, timeout);
|
||||||
create(done);
|
} else if (err) {
|
||||||
|
cb(new Error('unable to establish contact with ES'));
|
||||||
} else {
|
} else {
|
||||||
done(err);
|
// create a new client
|
||||||
|
doCreateClient(function () {
|
||||||
|
cb(void 0, client);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}());
|
||||||
} else {
|
});
|
||||||
doCreateClient(done);
|
|
||||||
}
|
|
||||||
|
|
||||||
function done(err) {
|
function doCreateClient(options, cb) {
|
||||||
cb(err, client);
|
if (typeof options === 'function') {
|
||||||
}
|
cb = options, options = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
var logConfig = _.has(options, 'logConfig')
|
||||||
|
? options.logConfig
|
||||||
|
: {
|
||||||
|
type: BROWSER
|
||||||
|
? 'console'
|
||||||
|
: VERBOSE
|
||||||
|
? 'tracer'
|
||||||
|
: 'stdio',
|
||||||
|
level: VERBOSE
|
||||||
|
? 'trace'
|
||||||
|
: 'warning',
|
||||||
|
path: VERBOSE ? undefined : false
|
||||||
|
};
|
||||||
|
|
||||||
function doCreateClient(cb) {
|
|
||||||
// close existing client
|
// close existing client
|
||||||
if (client) {
|
if (client) {
|
||||||
client.close();
|
client.close();
|
||||||
@ -71,17 +81,7 @@ module.exports = {
|
|||||||
port: esServer ? esServer.__port : argv.port
|
port: esServer ? esServer.__port : argv.port
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
log: {
|
log: logConfig
|
||||||
type: BROWSER
|
|
||||||
? 'console'
|
|
||||||
: VERBOSE
|
|
||||||
? 'tracer'
|
|
||||||
: 'stdio',
|
|
||||||
level: VERBOSE
|
|
||||||
? 'trace'
|
|
||||||
: 'warning',
|
|
||||||
path: VERBOSE ? undefined : false
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_.nextTick(cb);
|
_.nextTick(cb);
|
||||||
|
|||||||
Reference in New Issue
Block a user