Run all of the browser tests at once, since parallel builds no longer benefit us at codeship and this will probably make things run even faster

This commit is contained in:
Spencer Alger
2014-01-17 16:07:35 -07:00
parent 9c1c100ee1
commit bacd515545
11 changed files with 81 additions and 39 deletions

View File

@ -2,7 +2,7 @@ module.exports = function (grunt) {
grunt.registerTask('browser_clients:test', [
'browser_clients:build',
'run:browser_test_server',
'saucelabs-mocha'
'saucelabs-mocha:all'
]);
grunt.registerTask('browser_clients:build', [

View File

@ -28,7 +28,9 @@ module.exports = {
options: {
reporter: 'mocha-lcov-reporter',
coveralls: {
serviceName: 'travis-ci'
serviceName: 'codeship',
serviceJobId: process.env.CI_BUILD_NUMBER,
repoToken: process.env.COVERALLS_TOKEN
}
}
}

View File

@ -1,14 +1,15 @@
var keys = require('../../test/utils/keys');
module.exports = {
options: {
urls: [
'http://127.0.0.1:8000/unit.html',
'http://127.0.0.1:8000/builds.html'
],
build: process.env.TRAVIS_JOB_ID || 'local_' + Date.now(),
detailedError: true
},
chrome: {
all: {
options: {
urls: [
'http://127.0.0.1:8000/unit.html',
'http://127.0.0.1:8000/builds.html'
],
testname: process.env.CI_BUILD_NUMBER ? 'build_' + process.env.CI_BUILD_NUMBER : 'local_' + Date.now(),
username: keys.saucelabs_user,
key: keys.saucelabs,
browsers: [
{
browserName: 'chrome',
@ -17,14 +18,7 @@ module.exports = {
{
browserName: 'chrome',
platform: 'Linux'
}
],
tags: ['master', 'chrome']
}
},
ie: {
options: {
browsers: [
},
{
browserName: 'internet explorer',
version: '11',
@ -39,14 +33,7 @@ module.exports = {
browserName: 'internet explorer',
version: '9',
platform: 'Windows 7'
}
],
tags: ['master', 'ie']
}
},
firefox: {
options: {
browsers: [
},
{
browserName: 'firefox',
platform: 'Windows 7'
@ -55,8 +42,7 @@ module.exports = {
browserName: 'firefox',
platform: 'Linux'
}
],
tags: ['master', 'firefox']
]
}
}
};

View File

@ -37,7 +37,7 @@
"load-grunt-tasks": "~0.2.0",
"load-grunt-config": "~0.7.0",
"grunt-s3": "~0.2.0-alpha.3",
"grunt-run": "~0.1.5",
"grunt-run": "~0.1.12",
"relative-fs": "0.0.1",
"grunt-contrib-compress": "~0.5.3",
"grunt-contrib-copy": "~0.4.1",
@ -48,7 +48,7 @@
"expect.js": "~0.2.0",
"aliasify": "~1.2.4",
"express": "~3.4.7",
"grunt-saucelabs": "git://github.com/axemclion/grunt-saucelabs.git#01b68705a6823ff86930f28296ac6467fbea244b"
"grunt-saucelabs": "~4.1.2"
},
"license": "Apache 2.0",
"dependencies": {
@ -65,7 +65,7 @@
"scripts": {
"test": "grunt test",
"blanket": {
"pattern": "src"
"pattern": [ "src" ]
}
}
}

View File

@ -1,3 +1,5 @@
#!/usr/bin/env bash
#####
# Start or stop a group for travis
#####

View File

@ -8,14 +8,12 @@
# ES_RELEASE - a specific ES release to download in use for testing
# NODE_UNIT=1 - 0/1 run the unit tests in node
# NODE_INTEGRATION=1 - 0/1 run the integration tests in node
# TEST_BROWSER - the browser to test in using, sauce labs. One of 'ie', 'firefox', 'chrome'
# BROWSER_UNIT - the browser to test in using, sauce labs. One of 'ie', 'firefox', 'chrome'
# COVERAGE - 0/1 check for coverage and ship it to coveralls
#
###########
export ES_NODE_NAME="elasticsearch_js_test_runner"
export SAUCE_USERNAME="elasticsearch-js"
export SAUCE_ACCESS_KEY="3259dd1e-a9f2-41cc-afd7-855d80588aeb"
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MOCHA="./node_modules/.bin/mocha"
@ -96,9 +94,9 @@ if [[ "$NODE_INTEGRATION" != "0" ]]; then
group "end:integration tests"
fi
if [[ -n "$TEST_BROWSER" ]]; then
if [[ "$BROWSER_UNIT" == "1" ]]; then
group "start:browser tests"
grunt_ browser_clients:build run:browser_test_server saucelabs-mocha:${TEST_BROWSER}
grunt_ browser_clients:build run:browser_test_server saucelabs-mocha
group "end:browser tests"
fi

46
scripts/codeship.sh Executable file
View File

@ -0,0 +1,46 @@
#!/usr/bin/env bash
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $HERE/_utils.sh
source $HOME/.nvm/nvm.sh
case $1 in
setup)
group "start: installing nvm 0.10"
nvm install 0.10
group "end: installing nvm 0.10"
group "start: installing nvm 0.8"
nvm install 0.8
group "end: installing nvm 0.8"
manage_es install master
manage_es install 0.90
npm install
;;
run)
# test in node 0.8
group "start: test node 0.8"
nvm use 0.8
echo "rebuilding npm deps"
npm rebuild &> /dev/null
call ES_BRANCH=master ./scripts/ci.sh
call ES_BRANCH=0.90 ./scripts/ci.sh
group "end: test node 0.8"
# test in node 0.10
group "start: test node 0.10"
nvm use 0.10
echo "rebuilding npm deps"
npm rebuild &> /dev/null
call ES_BRANCH=master COVERAGE=1 ./scripts/ci.sh
call ES_BRANCH=0.90 ./scripts/ci.sh
group "end: test node 0.10"
# browser tests (node version irrelevant)
group "start: test browsers"
call NODE_UNIT=0 NODE_INTEGRATION=0 BROWSER_UNIT=1 ./scripts/ci.sh
group "end: test browsers"
;;
esac

View File

@ -1,3 +1,5 @@
#!/usr/bin/env bash
if [ -z "$2" ]; then
echo "Usage:
From the root of the elasticsearch-js project call:

View File

@ -27,7 +27,7 @@
<!-- tests -->
<script src="build_tests.js"></script>
<script>
mocha.run().on('end', function(){
mochaRunner = mocha.run().on('end', function(){
window.mochaResults = this.stats;
});
</script>

View File

@ -17,7 +17,7 @@
</script>
<script src="unit_tests.js"></script>
<script>
mocha.run().on('end', function(){
mochaRunner = mocha.run().on('end', function(){
window.mochaResults = this.stats;
});
</script>

6
test/utils/keys.js Normal file
View File

@ -0,0 +1,6 @@
// I know this is horrible
// I just don't want the keys searchable on github
module.exports = JSON.parse(new Buffer(
'eyJzYXVjZWxhYnNfdXNlciI6ImVsYXN0aWNzZWFyY2gtanMiLCJzYXVjZWxhYnMiOiIyNGY0OWUwNy1kODJmLTQwNjctODU0ZS1kODE1ZWJkMTVlNDYifQ==',
'base64'
).toString('utf8'));