Skip to content

Commit

Permalink
Update dependencies (#468)
Browse files Browse the repository at this point in the history
* Fix docs-samples tests, round 1

* Fix circle.yml

* Add RUN_ALL_BUILDS flag

* More container builder bugfixes

* Tweak env vars + remove manual proxy install

* Env vars in bashrc don't evaluate dynamically, so avoid them

* Add semicolons for command ordering

* Add appengine/static-files test to circle.yaml

* Fix failing container builder tests

* Address comments
  • Loading branch information
Ace Nassri authored Aug 31, 2017
1 parent 18210b3 commit 4495be7
Show file tree
Hide file tree
Showing 63 changed files with 422 additions and 174 deletions.
4 changes: 2 additions & 2 deletions appengine/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"e2e-test": "samples test deploy"
},
"dependencies": {
"express": "4.15.3",
"express": "4.15.4",
"got": "7.1.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.4.16"
"@google-cloud/nodejs-repo-tools": "1.4.17"
},
"cloud-repo-tools": {
"test": {
Expand Down
31 changes: 24 additions & 7 deletions appengine/cloudsql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,53 @@
"lint": "samples lint",
"pretest": "npm run lint",
"unit-test": "ava --verbose test/*.test.js",
"start-proxy": "! pgrep cloud_sql_proxy > /dev/null && cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:$SQL_PORT &",
"system-test": "samples test app",
"test": "npm run unit-test && npm run system-test",
"system-test-proxy": "npm run start-proxy; npm run system-test",
"all-test": "npm run unit-test && npm run system-test",
"test": "samples test run --cmd npm -- run all-test",
"e2e-test": "samples test deploy"
},
"dependencies": {
"express": "4.15.3",
"knex": "^0.13.0",
"mysql": "2.13.0",
"pg": "^6.2.3",
"async": "2.5.0",
"express": "4.15.4",
"knex": "0.13.0",
"mysql": "2.14.1",
"pg": "7.2.0",
"prompt": "1.0.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.4.15",
"ava": "0.19.1"
"@google-cloud/nodejs-repo-tools": "1.4.17",
"ava": "0.22.0"
},
"cloud-repo-tools": {
"requiresKeyFile": true,
"requiresProjectId": true,
"test": {
"app": {
"requiredEnvVars": [
"SQL_CLIENT",
"SQL_USER",
"SQL_PASSWORD",
"SQL_DATABASE",
"SQL_PORT",
"INSTANCE_CONNECTION_NAME"
],
"msg": "Last 10 visits:",
"substitutions": "YOUR_SQL_CLIENT=$SQL_CLIENT,YOUR_USER=$SQL_USER,YOUR_PASSWORD=$SQL_PASSWORD,YOUR_DATABASE=$SQL_DATABASE,YOUR_INSTANCE_CONNECTION_NAME=$INSTANCE_CONNECTION_NAME",
"args": [
"server.js"
]
},
"build": {
"requiredEnvVars": [
"SQL_CLIENT",
"SQL_USER",
"SQL_PASSWORD",
"SQL_DATABASE",
"SQL_PORT",
"INSTANCE_CONNECTION_NAME"
]
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions appengine/datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
},
"dependencies": {
"@google-cloud/datastore": "1.1.0",
"express": "4.15.3"
"express": "4.15.4"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.4.16"
"@google-cloud/nodejs-repo-tools": "1.4.17"
},
"cloud-repo-tools": {
"test": {
Expand Down
2 changes: 1 addition & 1 deletion appengine/endpoints/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"dependencies": {
"body-parser": "1.17.2",
"express": "4.15.3",
"express": "4.15.4",
"safe-buffer": "5.1.1"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions appengine/errorreporting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
},
"dependencies": {
"@google-cloud/error-reporting": "0.2.1",
"express": "4.15.3"
"express": "4.15.4"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.4.16",
"@google-cloud/nodejs-repo-tools": "1.4.17",
"ava": "0.21.0",
"proxyquire": "1.8.0",
"sinon": "3.0.0"
"sinon": "3.2.0"
},
"cloud-repo-tools": {
"test": {
Expand Down
4 changes: 2 additions & 2 deletions appengine/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"e2e-test": "samples test deploy"
},
"dependencies": {
"express": "4.15.3"
"express": "4.15.4"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.4.16"
"@google-cloud/nodejs-repo-tools": "1.4.17"
},
"cloud-repo-tools": {
"test": {
Expand Down
4 changes: 2 additions & 2 deletions appengine/mailjet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
},
"dependencies": {
"body-parser": "1.17.2",
"express": "4.15.3",
"express": "4.15.4",
"jade": "1.11.0",
"node-mailjet": "3.2.1"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.4.16"
"@google-cloud/nodejs-repo-tools": "1.4.17"
},
"cloud-repo-tools": {
"test": {
Expand Down
27 changes: 25 additions & 2 deletions appengine/mongodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,31 @@
"engines": {
"node": ">=4.3.2"
},
"scripts": {
"start": "node server.js",
"test": "samples test app"
},
"cloud-repo-tools": {
"test": {
"app": {
"requiredEnvVars": [
"mongoHost",
"mongoPort",
"mongoUser",
"mongoPassword"
],
"msg": "IPs:\n::1;",
"args": [
"server.js"
]
}
}
},
"dependencies": {
"nconf": "0.8.4",
"mongodb": "2.2.22"
"mongodb": "2.2.31",
"nconf": "0.8.4"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^1.4.17"
}
}
3 changes: 0 additions & 3 deletions appengine/mongodb/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,10 @@ const port = nconf.get('mongoPort');

// [START client]
let uri = `mongodb://${user}:${pass}@${host}:${port}`;

if (nconf.get('mongoDatabase')) {
uri = `${uri}/${nconf.get('mongoDatabase')}`;
}

console.log(uri);

mongodb.MongoClient.connect(uri, (err, db) => {
if (err) {
throw err;
Expand Down
4 changes: 2 additions & 2 deletions appengine/pubsub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Before you can run or deploy the sample, you will need to do the following:
1. Enable the Cloud Pub/Sub API in the [Google Developers Console](https://console.developers.google.com/project/_/apiui/apiview/pubsub/overview).
1. Create a topic and subscription.

gcloud alpha pubsub topics create <your-topic-name>
gcloud alpha pubsub subcriptions create <your-subscription-name> \
gcloud beta pubsub topics create <your-topic-name>
gcloud beta pubsub subcriptions create <your-subscription-name> \
--topic <your-topic-name> \
--push-endpoint \
https://<your-project-id>.appspot.com/pubsub/push?token=<your-verification-token> \
Expand Down
5 changes: 5 additions & 0 deletions appengine/pubsub/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const Buffer = require('safe-buffer').Buffer;
const process = require('process'); // Required for mocking environment variables

// By default, the client will authenticate using the service account file
// specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable and use
Expand All @@ -32,6 +34,7 @@ const pubsub = PubSub();

const app = express();
app.set('view engine', 'pug');
app.set('views', path.join(__dirname, 'views'));

const formBodyParser = bodyParser.urlencoded({ extended: false });
const jsonBodyParser = bodyParser.json();
Expand Down Expand Up @@ -91,3 +94,5 @@ app.listen(PORT, () => {
console.log('Press Ctrl+C to quit.');
});
// [END app]

module.exports = app;
4 changes: 2 additions & 2 deletions appengine/pubsub/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ env: flex

# [START env]
env_variables:
PUBSUB_TOPIC: <your-topic-name>
PUBSUB_TOPIC: YOUR_TOPIC_NAME
# This token is used to verify that requests originate from your
# application. It can be any sufficiently random string.
PUBSUB_VERIFICATION_TOKEN: <your-verification-token>
PUBSUB_VERIFICATION_TOKEN: YOUR_VERIFICATION_TOKEN
# [END env]
# [END app_yaml]
38 changes: 32 additions & 6 deletions appengine/pubsub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,39 @@
"node": ">=4.3.2"
},
"scripts": {
"start": "node app.js"
"start": "node app.js",
"test": "samples test app && ava -T 30s */*.test.js"
},
"dependencies": {
"@google-cloud/pubsub": "0.8.0",
"body-parser": "1.16.0",
"express": "4.14.1",
"pug": "2.0.0-beta6",
"safe-buffer": "5.0.1"
"@google-cloud/pubsub": "0.13.2",
"body-parser": "1.17.2",
"express": "4.15.4",
"pug": "2.0.0-rc.3",
"safe-buffer": "5.1.1"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.4.17",
"ava": "0.22.0",
"uuid": "3.1.0"
},
"cloud-repo-tools": {
"requiresProjectId": true,
"requiresKeyFile": true,
"test": {
"app": {
"requiredEnvVars": [
"PUBSUB_TOPIC",
"PUBSUB_VERIFICATION_TOKEN"
],
"msg": "Messages received by this instance",
"substitutions": "YOUR_TOPIC_NAME=$PUBSUB_TOPIC,YOUR_VERIFICATION_TOKEN=$PUBSUB_VERIFICATION_TOKEN"
},
"build": {
"requiredEnvVars": [
"PUBSUB_TOPIC",
"PUBSUB_VERIFICATION_TOKEN"
]
}
}
}
}
72 changes: 72 additions & 0 deletions appengine/pubsub/test/app.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright 2017, 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.

// NOTE:
// This app can only be fully tested when deployed, because
// Pub/Sub requires a live endpoint URL to hit. Nevertheless,
// these tests mock it and partially test it locally.

'use strict';

const test = require(`ava`);
const path = require(`path`);
const utils = require(`@google-cloud/nodejs-repo-tools`);

const message = `This is a test message sent at: `;
const payload = message + Date.now();

const cwd = path.join(__dirname, `../`);
const requestObj = utils.getRequest({ cwd: cwd });

test.serial.cb(`should send a message to Pub/Sub`, (t) => {
requestObj
.post(`/`)
.type('form')
.send({ payload: payload })
.expect(200)
.expect((response) => {
t.is(response.text, `Message sent`);
})
.end(t.end);
});

test.serial.cb(`should receive incoming Pub/Sub messages`, (t) => {
requestObj
.post(`/pubsub/push`)
.query({ token: process.env.PUBSUB_VERIFICATION_TOKEN })
.send({
message: {
data: payload
}
})
.expect(200)
.end(t.end);
});

test.serial.cb(`should check for verification token on incoming Pub/Sub messages`, (t) => {
requestObj
.post(`/pubsub/push`)
.field(`payload`, payload)
.expect(400)
.end(t.end);
});

test.serial.cb(`should list sent Pub/Sub messages`, (t) => {
requestObj
.get(`/`)
.expect(200)
.expect((response) => {
t.regex(response.text, /Messages received by this instance/);
})
.end(t.end);
});
18 changes: 15 additions & 3 deletions appengine/static-files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@
"node": ">=4.3.2"
},
"scripts": {
"start": "node app.js"
"start": "node app.js",
"test": "samples test app --url localhost:8080/static/main.css"
},
"cloud-repo-tools": {
"test": {
"app": {
"msg": "background-color",
"port": 8080
}
}
},
"dependencies": {
"express": "4.14.1",
"pug": "2.0.0-beta6"
"express": "4.15.4",
"pug": "2.0.0-rc.3"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.4.17"
}
}
Loading

0 comments on commit 4495be7

Please sign in to comment.