Added support for jenkins to the ci script

This commit is contained in:
Spencer Alger
2014-01-14 23:44:00 -07:00
parent 18e134d0a6
commit ac67eab8d8
7 changed files with 40 additions and 53 deletions

View File

@ -9,7 +9,7 @@ module.exports = {
src: 'test/integration/yaml_suite/index.js'
},
integration_0_90: {
'integration_0.90': {
src: 'test/integration/yaml_suite/index_0_90.js'
},

View File

@ -18,14 +18,6 @@ module.exports = {
]
}
},
generate_yaml_tests: {
exec: 'node ./scripts/generate/index.js --no-api',
options: {
passArgs: [
'verbose'
]
}
},
browser_test_server: {
exec: 'node ./test/utils/server',
options: {
@ -49,10 +41,10 @@ module.exports = {
}
}
},
install_es_0_90: {
'install_es_0.90': {
exec: './scripts/es.sh install 0.90',
},
es_0_90: {
'es_0.90': {
exec: './.snapshots/0.90_nightly/bin/elasticsearch -f ' + esOpts,
options: {
wait: false,

View File

@ -15,10 +15,10 @@ module.exports = function (grunt) {
'mochacov:integration_master',
'stop:es_master',
'run:install_es_0_90',
'run:es_0_90',
'mochacov:integration_0_90',
'stop:es_0_90'
'run:install_es_0.90',
'run:es_0.90',
'mochacov:integration_0.90',
'stop:es_0.90'
]);
grunt.registerTask('unit_test', [

View File

@ -59,7 +59,7 @@ function manage_es {
case "$DO" in
install)
if [ ! -d "$ES_DIR" ]; then
if [ ! -x "$ES_BIN" ]; then
echo "Downloading Elasticsearch $ES_VERSION"
call rm -rf ${SNAPSHOTS}/${ES_VERSION}*
call curl -#O $ES_URL
@ -69,6 +69,8 @@ function manage_es {
if [ -z "$ES_RELEASE" ]; then
ln -sf $ES_DIR "${SNAPSHOTS}/${ES_VERSION}"
fi
else
echo "$ES_VERSION installed"
fi
;;
start)
@ -80,7 +82,7 @@ function manage_es {
if [ $RUNNING -eq 0 ]; then
echo "Already running $ES_VERSION"
exit 1
return 1
else
echo "PID file was left behind by ES"
call rm $PIDFILE
@ -91,11 +93,15 @@ function manage_es {
if [ ! -x "$ES_BIN" ]; then
echo "Unable to find elasticsearch executable"
exit 1
return 1
fi
local ES_OPTS="-p $PIDFILE -Des.network.host=localhost -Des.discovery.zen.ping.multicast.enabled=false -Des.discovery.zen.ping_timeout=1"
if [ -n "$ES_NODE_NAME" ]; then
ES_OPTS="$ES_OPTS -Des.node.name=$ES_NODE_NAME"
fi
if [ "$ES_BRANCH" = "0.90" ]; then
echo "Starting Elasticsearch $ES_VERSION"
call $ES_BIN $ES_OPTS
@ -113,13 +119,13 @@ function manage_es {
if [ $RUNNING -eq 0 ]; then
kill $PID
echo "Elasticsearch $ES_VERSION stopped"
exit 0
return 0
fi
rm $PIDFILE
fi
echo "Elasticsearch $ES_VERSION is not running."
exit 1
return 1
;;
esac
group "end:$DO es"

View File

@ -15,7 +15,10 @@
#
###########
source _utils.sh
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ES_NODE_NAME="elasticsearch_js_test_runner"
source $HERE/_utils.sh
#####
# call grunt, but make sure it's installed first
@ -33,11 +36,16 @@ function grunt_ {
call grunt $DO
}
if [ -n "$ES_BRANCH" ]; then
TESTING_BRANCH=$ES_BRANCH
elif [ -n "$ES_V" ]; then
TESTING_BRANCH=$ES_V
re='^(.*)_nightly$';
if [[ $ES_V =~ $re ]]; then
TESTING_BRANCH=${BASH_REMATCH[1]}
else
echo "unable to parse ES_V $ES_V"
exit 1
fi
else
TESTING_BRANCH="master"
fi
@ -47,15 +55,14 @@ if [[ "$NODE_UNIT" != "0" ]]; then
fi
if [[ "$NODE_INTEGRATION" != "0" ]]; then
if [[ -n "$ES_BRANCH" ]] && [[ "$USER" != "jenkins" ]]; then
manage_es start $ES_BRANCH $ES_RELEASE
call node scripts/generate --no-api
if [[ "$USER" != "jenkins" ]]; then
manage_es start $TESTING_BRANCH $ES_RELEASE
fi
call node scripts/generate --no-api --es_branch=\"$TESTING_BRANCH\"
grunt_ mochacov:integration
if [[ -n "$ES_BRANCH" ]] && [[ "$USER" != "jenkins" ]]; then
manage_es stop $ES_BRANCH $ES_RELEASE
grunt_ mochacov:integration_$TESTING_BRANCH
if [[ "$USER" != "jenkins" ]]; then
manage_es stop $TESTING_BRANCH $ES_RELEASE
fi
fi

View File

@ -16,4 +16,5 @@ fi
source scripts/_utils.sh
manage_es $*
manage_es $*
exit $?

View File

@ -1,25 +1,6 @@
#!/usr/bin/env bash
export VERBOSE="true"
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -x $ES_V ]; then
echo "missing ES_V environment var"
exit 1
fi
# generate the latest version of the yaml-tests
node scripts/generate --es_branch="=$ES_V" --no-api
# unit tests
./node_modules/.bin/mocha test/unit/test_*.js \
--require should \
--reporter ../../../test/utils/jenkins-reporter.js \
2> test/junit-node-unit.xml
# run the integration tests
./node_modules/.bin/mocha test/integration/yaml_suite/index.js \
--require should \
--host localhost \
--port $es_port \
--reporter ../../../test/utils/jenkins-reporter.js \
2> test/junit-node-integration.xml
source $HERE/ci.sh