ci.sh now calls mocha directly so that it can pass the port from jenkins and use the jenkins reporter

This commit is contained in:
Spencer Alger
2014-01-15 14:41:57 -07:00
parent 67974dc16f
commit d4c0f71419
3 changed files with 36 additions and 7 deletions

View File

@ -28,7 +28,7 @@ source $HERE/_utils.sh
function grunt_ {
local DO="$*"
if [ ! -x "`which grunt`" ]; then
if [[ ! -x "`which grunt`" ]]; then
group "start:install_grunt"
echo "installing grunt-cli"
call npm install -g grunt-cli
@ -38,9 +38,10 @@ function grunt_ {
call grunt $DO
}
if [ -n "$ES_BRANCH" ]; then
# normalize ES_BRANCH into TESTING_BRANCH
if [[ -n "$ES_BRANCH" ]]; then
TESTING_BRANCH=$ES_BRANCH
elif [ -n "$ES_V" ]; then
elif [[ -n "$ES_V" ]]; then
re='^(.*)_nightly$';
if [[ $ES_V =~ $re ]]; then
TESTING_BRANCH=${BASH_REMATCH[1]}
@ -52,6 +53,21 @@ else
TESTING_BRANCH="master"
fi
# convert TESTING_BRANCH into BRANCH_SUFFIX
if [[ $TESTING_BRANCH = 'master' ]]; then
BRANCH_SUFFIX=''
else
BRANCH_SUFFIX=${TESTING_BRANCH//./_}
fi
# find value of ES_PORT
if [[ -n "$es_port" ]]; then
# jenkins
ES_PORT=$es_port
else
ES_PORT=9200
fi
if [[ "$NODE_UNIT" != "0" ]]; then
grunt_ jshint mochacov:unit
fi
@ -61,11 +77,22 @@ if [[ "$NODE_INTEGRATION" != "0" ]]; then
call node scripts/generate --no-api
group "end:generate_tests"
if [[ "$USER" != "jenkins" ]]; then
MOCHA_EXE="./node_modules/.bin/mocha test/integration/yaml_suite/index${BRANCH_SUFFIX}.js
--require should
--host localhost
--port $ES_PORT"
if [[ -n "$JENKINS" ]]; then
MOCHA_EXE="$MOCHA_EXE
--reporter ../../../test/utils/jenkins-reporter.js
2> test/junit-node-integration.xml"
else
manage_es start $TESTING_BRANCH $ES_RELEASE
fi
grunt_ mochacov:integration_$TESTING_BRANCH
if [[ "$USER" != "jenkins" ]]; then
call $MOCHA_EXE
if [[ -z "$JENKINS" ]]; then
manage_es stop $TESTING_BRANCH $ES_RELEASE
fi
fi

View File

@ -1,6 +1,7 @@
#!/usr/bin/env bash
export VERBOSE="true"
export JENKINS="true"
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $HERE/ci.sh

View File

@ -1,5 +1,6 @@
var BROWSER = process.env.browser;
var VERBOSE = process.env.VERBOSE;
var JENKINS = process.env.JENKINS;
if (BROWSER) {
/* jshint browser: true */
@ -35,7 +36,7 @@ module.exports = {
setTimeout(ping, timeout);
} else if (err) {
cb(new Error('unable to establish contact with ES'));
} else if (resp.name !== 'elasticsearch_js_test_runner') {
} else if (!JENKINS && resp.name !== 'elasticsearch_js_test_runner') {
console.log(resp);
cb(new Error('Almosted wiped out another es node. Shut-down all instances of ES and try again.'));
} else {