From ca9d1e4c04a70f7fdc4f069322fd9eb71a1adc9f Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Tue, 26 Jan 2016 14:47:58 -0800 Subject: [PATCH] Move back to container-based Travis builds and removed some redundant tests. --- .travis.yml | 35 +++++++++---- package.json | 6 +-- .../express-memcached-session.test.js | 26 ---------- test/appengine/express.test.js | 49 ------------------- test/appengine/sendgrid.test.js | 36 -------------- test/logging/write.test.js | 26 ++++++---- test/prediction/hostedmodels.test.js | 1 + 7 files changed, 45 insertions(+), 134 deletions(-) delete mode 100644 test/appengine/express-memcached-session.test.js delete mode 100644 test/appengine/express.test.js delete mode 100644 test/appengine/sendgrid.test.js diff --git a/.travis.yml b/.travis.yml index ba11c18edb..d0ffee18ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -sudo: required +sudo: false language: node_js node_js: - "stable" @@ -19,26 +19,45 @@ node_js: - "0.10" cache: - directories: - - $HOME/gcloud/ + directories: + - appengine/analytics/node_modules/ - appengine/bower/node_modules/ + - appengine/cloudsql/node_modules/ + - appengine/datastore/node_modules/ + - appengine/disk/node_modules/ - appengine/express/node_modules/ - appengine/express-memcached-session/node_modules/ + - appengine/extending-runtime/node_modules/ - appengine/geddy/node_modules/ - appengine/grunt/node_modules/ - appengine/hapi/node_modules/ + - appengine/hello-world/node_modules/ + - appengine/koa/node_modules/ - appengine/kraken/node_modules/ + - appengine/logging/node_modules/ - appengine/loopback/node_modules/ - appengine/mailgun/node_modules/ + - appengine/memcached/node_modules/ + - appengine/mongodb/node_modules/ - appengine/redis/node_modules/ - appengine/restify/node_modules/ - appengine/sails/node_modules/ + - appengine/sendgrid/node_modules/ + - appengine/static-files/node_modules/ + - appengine/storage/node_modules/ + - appengine/twilio/node_modules/ - appengine/webpack/node_modules/ + - appengine/websockets/node_modules/ + - computeengine/sendgrid/node_modules/ + - datastore/node_modules/ + - logging/node_modules/ + - prediction/node_modules/ + - pubsub/node_modules/ + - storage/node_modules/ services: - redis-server - memcached - - docker env: - PATH=$PATH:$HOME/gcloud/google-cloud-sdk/bin GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/test/encrypted/nodejs-docs-samples.json TEST_BUCKET_NAME=nodejs-docs-samples GCLOUD_PROJECT=nodejs-docs-samples #Other environment variables on same line @@ -50,18 +69,14 @@ before_install: cd $HOME/gcloud && tar xzf google-cloud-sdk.tar.gz && printf '\ny\n\ny\ny\n' | ./google-cloud-sdk/install.sh && - source /home/travis/.bash_profile && + source $HOME/.bashrc && cd $TRAVIS_BUILD_DIR; fi - - gcloud components update -q - - gcloud components update app -q - openssl aes-256-cbc -K $encrypted_fda0b707c7d5_key -iv $encrypted_fda0b707c7d5_iv -in test/encrypted/nodejs-docs-samples.json.enc -out test/encrypted/nodejs-docs-samples.json -d - if [ -a test/encrypted/nodejs-docs-samples.json ]; then gcloud auth activate-service-account --key-file test/encrypted/nodejs-docs-samples.json; fi + - npm set progress=false after_success: - npm run coveralls - -after_script: - - gsutil -m cp *.log gs://nodejs-docs-samples-travis-deployments diff --git a/package.json b/package.json index 19a47fb584..b359d3a20d 100644 --- a/package.json +++ b/package.json @@ -33,11 +33,9 @@ "deps_storage": "cd storage; npm i; cd ../..", "deps_prediction": "cd prediction; npm i; cd ../..", "deps_logging": "cd logging; npm i; cd ../..", - "deps_express": "cd appengine/express; npm i; cd ../..", - "deps_sendgrid": "cd appengine/sendgrid; npm i; cd ../..; cd computeengine/sendgrid; npm i; cd ../..", - "deps_memcached": "cd appengine/express-memcached-session && npm i && cd ../..", + "deps_sendgrid": "cd computeengine/sendgrid; npm i; cd ../..", "pretest_geddy": "cd appengine/geddy; npm i geddy; GEDDY_SECRET=config/secrets.json; [[ -f $GEDDY_SECRET ]] || echo '{}' > $GEDDY_SECRET && node node_modules/.bin/geddy gen secret; cd ../..;", - "pretest": "npm run deps_datastore; npm run deps_storage; npm run deps_pubsub; npm run deps_prediction; npm run deps_logging; npm run deps_memcached; npm run deps_express; npm run deps_sendgrid; npm run pretest_geddy", + "pretest": "npm run deps_datastore; npm run deps_storage; npm run deps_pubsub; npm run deps_prediction; npm run deps_logging; npm run deps_sendgrid; npm run pretest_geddy", "test": "npm run jshint && npm run cover" }, "devDependencies": { diff --git a/test/appengine/express-memcached-session.test.js b/test/appengine/express-memcached-session.test.js deleted file mode 100644 index e655ccc9bf..0000000000 --- a/test/appengine/express-memcached-session.test.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015-2016, Google, Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -var request = require('supertest'); -var app = require('../../appengine/express-memcached-session/server.js'); - -describe('express-memcached-session', function () { - it('should return 200', function (done) { - request(app) - .get('/') - .expect(200) - .end(done); - }); -}); diff --git a/test/appengine/express.test.js b/test/appengine/express.test.js deleted file mode 100644 index 2473e8e783..0000000000 --- a/test/appengine/express.test.js +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015-2016, Google, Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -var assert = require('assert'); -var request = require('supertest'); -var app = require('../../appengine/express/app.js'); - -describe('express', function () { - it('should return 200 and a "Hello World" message', function (done) { - var message = 'Hello World! Express.js on Google App Engine.'; - - request(app) - .get('/') - .expect(200) - .expect(function (res) { - assert( - res.text.indexOf(message) !== -1, - 'Response should contain a "Hello World" message.\n' + - 'Found: ' + res.text - ); - }) - .end(done); - }); - it('should respond with a resource on the "users" route', function (done) { - request(app) - .get('/users') - .expect(200) - .expect('respond with a resource') - .end(done); - }); - it('should respond with a 404 to unknown request', function (done) { - request(app) - .get('/doesnotexist') - .expect(404) - .end(done); - }); -}); diff --git a/test/appengine/sendgrid.test.js b/test/appengine/sendgrid.test.js deleted file mode 100644 index 7ebcab9169..0000000000 --- a/test/appengine/sendgrid.test.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015-2016, Google, Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -var assert = require('assert'); -var request = require('supertest'); -var app = require('../../appengine/sendgrid/app.js'); - -describe('sendgrid', function () { - it('should return 200 and a "Hello World" message', function (done) { - var message = 'Express.js + Sendgrid on Google App Engine'; - - request(app) - .get('/') - .expect(200) - .expect(function (res) { - assert( - res.text.indexOf(message) !== -1, - 'Response should contain a "Hello World" message.\n' + - 'Found: ' + res.text - ); - }) - .end(done); - }); -}); diff --git a/test/logging/write.test.js b/test/logging/write.test.js index ae363410e0..841fdd4e6f 100644 --- a/test/logging/write.test.js +++ b/test/logging/write.test.js @@ -23,17 +23,25 @@ describe('logging/write', function () { if (err) { return done(err); } - assert.deepEqual(apiResponse, {}, 'should have correct response'); - done(); - }); - }); - it('should delete entries', function (done) { - logging.deleteLog(function (err, apiResponse) { - if (err) { + try { + assert.deepEqual(apiResponse, {}, 'should have correct response'); + logging.deleteLog(function (err, apiResponse) { + if (err) { + if (err.code === 404) { + return done(); + } + return done(err); + } + try { + assert.deepEqual(apiResponse, {}, 'should have correct response'); + return done(); + } catch (err) { + return done(err); + } + }); + } catch (err) { return done(err); } - assert.deepEqual(apiResponse, {}, 'should have correct response'); - done(); }); }); }); diff --git a/test/prediction/hostedmodels.test.js b/test/prediction/hostedmodels.test.js index cd7926fd9e..bc3c2dd0cf 100644 --- a/test/prediction/hostedmodels.test.js +++ b/test/prediction/hostedmodels.test.js @@ -31,6 +31,7 @@ var EXPECTED_RESULT = { describe('prediction/hostedmodels', function () { it('should predict', function (done) { + this.timeout(30000); hostedmodels.predict(function (err, result) { if (err) { return done(err);