Updated testing to pull yaml tests from a specific es branch, and setup
travis script that will download the latest build from a branch or a release based on the config it receives.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -13,4 +13,5 @@ test/integration/yaml_suite/yaml_tests.json
|
|||||||
junit-*.xml
|
junit-*.xml
|
||||||
test.log
|
test.log
|
||||||
elasticsearch*.log
|
elasticsearch*.log
|
||||||
coverage.html
|
coverage.html
|
||||||
|
.snapshots
|
||||||
25
.travis.yml
25
.travis.yml
@ -2,9 +2,22 @@ language: node_js
|
|||||||
node_js:
|
node_js:
|
||||||
- "0.10"
|
- "0.10"
|
||||||
- "0.8"
|
- "0.8"
|
||||||
services:
|
env:
|
||||||
- elasticsearch
|
# - ES_RELEASE=0.90.0 ES_BRANCH=0.90
|
||||||
before_script:
|
# - ES_RELEASE=0.90.1 ES_BRANCH=0.90
|
||||||
- npm install -g grunt-cli
|
# - ES_RELEASE=0.90.2 ES_BRANCH=0.90
|
||||||
script:
|
# - ES_RELEASE=0.90.3 ES_BRANCH=0.90
|
||||||
- grunt travis
|
# - ES_RELEASE=0.90.4 ES_BRANCH=0.90
|
||||||
|
# - ES_RELEASE=0.90.5 ES_BRANCH=0.90
|
||||||
|
# - ES_RELEASE=0.90.6 ES_BRANCH=0.90
|
||||||
|
- ES_RELEASE=0.90.7 ES_BRANCH=0.90
|
||||||
|
- ES_RELEASE=0.90.8 ES_BRANCH=0.90
|
||||||
|
- ES_RELEASE=0.90.9 ES_BRANCH=0.90
|
||||||
|
- ES_BRANCH=0.90
|
||||||
|
- ES_BRANCH=master
|
||||||
|
script: ./scripts/travis.sh
|
||||||
|
email:
|
||||||
|
recipients:
|
||||||
|
- spencer.alger@elasticsearch.com
|
||||||
|
on_success: change
|
||||||
|
on_failure: always
|
||||||
@ -1,18 +1,24 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
options: {
|
|
||||||
cwd: './scripts'
|
|
||||||
},
|
|
||||||
generate: {
|
generate: {
|
||||||
exec: 'node generate/index.js',
|
exec: 'node ./scripts/generate/index.js',
|
||||||
options: {
|
options: {
|
||||||
passArgs: [
|
passArgs: [
|
||||||
'verbose',
|
'verbose',
|
||||||
'es_version'
|
'es_branch'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
generate_yaml_tests: {
|
||||||
|
exec: 'node ./scripts/generate/index.js --no-api',
|
||||||
|
options: {
|
||||||
|
passArgs: [
|
||||||
|
'verbose',
|
||||||
|
'es_branch'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
browser_integration_tests: {
|
browser_integration_tests: {
|
||||||
exec: 'node run_browser_integration_suite',
|
exec: 'node ./scripts/run_browser_integration_suite',
|
||||||
options: {
|
options: {
|
||||||
passArgs: [
|
passArgs: [
|
||||||
'browsers'
|
'browsers'
|
||||||
|
|||||||
@ -5,14 +5,10 @@ module.exports = function (grunt) {
|
|||||||
'test'
|
'test'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
grunt.registerTask('generate', [
|
|
||||||
'run:generate'
|
|
||||||
]);
|
|
||||||
|
|
||||||
grunt.registerTask('test', [
|
grunt.registerTask('test', [
|
||||||
'jshint',
|
'jshint',
|
||||||
'mochacov:unit',
|
'mochacov:unit',
|
||||||
'generate',
|
'run:generate',
|
||||||
'mochacov:integration',
|
'mochacov:integration',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -25,9 +21,4 @@ module.exports = function (grunt) {
|
|||||||
'mochacov:make_coverage_html',
|
'mochacov:make_coverage_html',
|
||||||
'open:coverage'
|
'open:coverage'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
grunt.registerTask('travis', [
|
|
||||||
'test',
|
|
||||||
'mochacov:ship_coverage'
|
|
||||||
]);
|
|
||||||
};
|
};
|
||||||
@ -20,7 +20,7 @@ var argv = require('optimist')
|
|||||||
default: true,
|
default: true,
|
||||||
boolean: true
|
boolean: true
|
||||||
},
|
},
|
||||||
es_version: {
|
es_branch: {
|
||||||
default: 'master',
|
default: 'master',
|
||||||
string: true,
|
string: true,
|
||||||
alias: 'b'
|
alias: 'b'
|
||||||
@ -39,62 +39,58 @@ if (!argv.force && process.env.FORCE || process.env.FORCE_GEN) {
|
|||||||
argv.force = argv.f = process.env.FORCE || process.env.FORCE_GEN;
|
argv.force = argv.f = process.env.FORCE || process.env.FORCE_GEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSubmodules(done) {
|
var branch = argv.es_branch;
|
||||||
var branch = argv.es_version;
|
// branch can be prefixed with = or suffixed with _nightly
|
||||||
// branch can be prefixed with = or suffixed with _nightly
|
if (branch.indexOf) {
|
||||||
if (branch.indexOf) {
|
['='].forEach(function removePrefix(pref) {
|
||||||
['='].forEach(function removePrefix(pref) {
|
if (branch.indexOf(pref) === 0) {
|
||||||
if (branch.indexOf(pref) === 0) {
|
branch = branch.substring(pref.length);
|
||||||
branch = branch.substring(pref.length);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
['_nightly'].forEach(function removeSuffix(suf) {
|
|
||||||
if (branch.indexOf(suf) === branch.length - suf.length) {
|
|
||||||
branch = branch.substr(0, branch.length - suf.length);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var stdio = [
|
|
||||||
'ignore',
|
|
||||||
argv.verbose ? process.stdout : 'ignore',
|
|
||||||
process.stderr
|
|
||||||
];
|
|
||||||
|
|
||||||
async.series([
|
|
||||||
function (done) {
|
|
||||||
// init submodules
|
|
||||||
cp.spawn('git', ['submodule', 'update', '--init'], {
|
|
||||||
stdio: stdio
|
|
||||||
}).on('exit', function (status) {
|
|
||||||
done(status ? new Error('Unable to init submodules.') : void 0);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
function (done) {
|
|
||||||
// checkout branch and clean it
|
|
||||||
cp.spawn('git', ['submodule', 'foreach', 'git checkout --detach origin/' + branch + ' && git clean -f'], {
|
|
||||||
stdio: stdio
|
|
||||||
}).on('exit', function (status) {
|
|
||||||
done(status ? new Error('Unable to init submodules.') : void 0);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
], done);
|
});
|
||||||
|
|
||||||
|
['_nightly'].forEach(function removeSuffix(suf) {
|
||||||
|
if (branch.indexOf(suf) === branch.length - suf.length) {
|
||||||
|
branch = branch.substr(0, branch.length - suf.length);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSubmodules(function (err) {
|
var stdio = [
|
||||||
|
'ignore',
|
||||||
|
argv.verbose ? process.stdout : 'ignore',
|
||||||
|
process.stderr
|
||||||
|
];
|
||||||
|
|
||||||
|
async.series([
|
||||||
|
function (done) {
|
||||||
|
cp.spawn('git', ['submodule', 'update', '--init'], {
|
||||||
|
stdio: stdio
|
||||||
|
}).on('exit', function (status) {
|
||||||
|
done(status ? new Error('Unable to init submodules.') : void 0);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function (done) {
|
||||||
|
// checkout branch and clean it
|
||||||
|
cp.spawn('git', ['submodule', 'foreach', 'git checkout origin/' + branch + ' && git clean -f'], {
|
||||||
|
stdio: stdio
|
||||||
|
}).on('exit', function (status) {
|
||||||
|
done(status ? new Error('Unable to checkout ' + branch) : void 0);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function (done) {
|
||||||
|
var tasks = [];
|
||||||
|
|
||||||
|
if (argv.api) {
|
||||||
|
tasks.push(require('./js_api'));
|
||||||
|
}
|
||||||
|
if (argv.tests) {
|
||||||
|
tasks.push(require('./yaml_tests'));
|
||||||
|
}
|
||||||
|
|
||||||
|
async.parallel(tasks, done);
|
||||||
|
}
|
||||||
|
], function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tasks = [];
|
|
||||||
|
|
||||||
if (argv.api) {
|
|
||||||
tasks.push(require('./js_api'));
|
|
||||||
}
|
|
||||||
if (argv.tests) {
|
|
||||||
tasks.push(require('./yaml_tests'));
|
|
||||||
}
|
|
||||||
|
|
||||||
async.parallel(tasks, function () {});
|
|
||||||
});
|
});
|
||||||
@ -1,8 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
# generate the latest version of the yaml-tests
|
# generate the latest version of the yaml-tests
|
||||||
node scripts/generate/ --no-api --es_version="=$ES_V"
|
./node_modules/.bin/grunt run:generate_yaml_tests --es_branch="=$ES_V"
|
||||||
|
|
||||||
export VERBOSE="true"
|
export VERBOSE="true"
|
||||||
|
|
||||||
|
|||||||
74
scripts/travis.sh
Executable file
74
scripts/travis.sh
Executable file
@ -0,0 +1,74 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [ -z $ES_BRANCH ]; then
|
||||||
|
echo "Missing ES_BRANCH environment var"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ROOT="$PWD"
|
||||||
|
ES_SUBMODULE="$ROOT/src/elasticsearch"
|
||||||
|
SNAPSHOTS="$ROOT/.snapshots"
|
||||||
|
ES_BIN="$SNAPSHOTS/es/bin/elasticsearch"
|
||||||
|
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"
|
||||||
|
|
||||||
|
if [ ! -z $ES_RELEASE ]; then
|
||||||
|
ES_VERSION="v${ES_RELEASE}"
|
||||||
|
ES_URL="https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-${ES_RELEASE}.zip"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -en 'travis_fold:start:setup_es\\r'
|
||||||
|
if [ -d $SNAPSHOTS ]; then
|
||||||
|
echo "wiping out existing snapshots"
|
||||||
|
rm -rf $SNAPSHOTS
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Killing existsing java processes"
|
||||||
|
killall java 2>/dev/null
|
||||||
|
|
||||||
|
echo "Downloading Elasticsearch $ES_VERSION to $SNAPSHOTS"
|
||||||
|
mkdir $SNAPSHOTS &&
|
||||||
|
cd $SNAPSHOTS \
|
||||||
|
&& curl -O $ES_URL \
|
||||||
|
&& unzip elasticsearch-*.zip \
|
||||||
|
|
||||||
|
cd $ROOT
|
||||||
|
|
||||||
|
if [ ! -d $SNAPSHOTS ]; then
|
||||||
|
echo "Failed to download ES"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv $SNAPSHOTS/elasticsearch-*/ $SNAPSHOTS/es/
|
||||||
|
|
||||||
|
if [ ! -x $ES_BIN ]; then
|
||||||
|
echo "Unable to find elasticsearch binary $ES_BIN"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $ES_BRANCH = "0.90" ]; then
|
||||||
|
echo "Starting Elasticsearch $ES_VERSION"
|
||||||
|
$ES_BIN \
|
||||||
|
-Des.network.host=localhost \
|
||||||
|
-Des.discovery.zen.ping.multicast.enabled=false \
|
||||||
|
-Des.discovery.zen.ping_timeout=1
|
||||||
|
else
|
||||||
|
echo "Starting Elasticsearch $ES_VERSION as a deamon"
|
||||||
|
$ES_BIN -d \
|
||||||
|
-Des.network.host=localhost \
|
||||||
|
-Des.discovery.zen.ping.multicast.enabled=false \
|
||||||
|
-Des.discovery.zen.ping_timeout=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 3
|
||||||
|
echo -en 'travis_fold:end:setup_es\\r'
|
||||||
|
|
||||||
|
echo -en 'travis_fold:start:install_grunt\\r'
|
||||||
|
npm install -g grunt-cli
|
||||||
|
echo -en 'travis_fold:end:install_grunt\\r'
|
||||||
|
|
||||||
|
grunt --es_branch="=$ES_BRANCH" jshint mochacov:unit run:generate_yaml_tests mochacov:integration mochacov:ship_coverage
|
||||||
|
RESULT=$?
|
||||||
|
|
||||||
|
killall java 2>/dev/null
|
||||||
|
exit $RESULT
|
||||||
Submodule src/elasticsearch updated: 7166ab6b6f...b9aaa79afd
Reference in New Issue
Block a user