Skip to content

Commit 4495be7

Browse files
author
Ace Nassri
authored
Update dependencies (#468)
* 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
1 parent 18210b3 commit 4495be7

File tree

63 files changed

+422
-174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+422
-174
lines changed

appengine/analytics/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
"e2e-test": "samples test deploy"
2323
},
2424
"dependencies": {
25-
"express": "4.15.3",
25+
"express": "4.15.4",
2626
"got": "7.1.0"
2727
},
2828
"devDependencies": {
29-
"@google-cloud/nodejs-repo-tools": "1.4.16"
29+
"@google-cloud/nodejs-repo-tools": "1.4.17"
3030
},
3131
"cloud-repo-tools": {
3232
"test": {

appengine/cloudsql/package.json

+24-7
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,53 @@
1818
"lint": "samples lint",
1919
"pretest": "npm run lint",
2020
"unit-test": "ava --verbose test/*.test.js",
21+
"start-proxy": "! pgrep cloud_sql_proxy > /dev/null && cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:$SQL_PORT &",
2122
"system-test": "samples test app",
22-
"test": "npm run unit-test && npm run system-test",
23+
"system-test-proxy": "npm run start-proxy; npm run system-test",
24+
"all-test": "npm run unit-test && npm run system-test",
25+
"test": "samples test run --cmd npm -- run all-test",
2326
"e2e-test": "samples test deploy"
2427
},
2528
"dependencies": {
26-
"express": "4.15.3",
27-
"knex": "^0.13.0",
28-
"mysql": "2.13.0",
29-
"pg": "^6.2.3",
29+
"async": "2.5.0",
30+
"express": "4.15.4",
31+
"knex": "0.13.0",
32+
"mysql": "2.14.1",
33+
"pg": "7.2.0",
3034
"prompt": "1.0.0"
3135
},
3236
"devDependencies": {
33-
"@google-cloud/nodejs-repo-tools": "1.4.15",
34-
"ava": "0.19.1"
37+
"@google-cloud/nodejs-repo-tools": "1.4.17",
38+
"ava": "0.22.0"
3539
},
3640
"cloud-repo-tools": {
41+
"requiresKeyFile": true,
42+
"requiresProjectId": true,
3743
"test": {
3844
"app": {
3945
"requiredEnvVars": [
4046
"SQL_CLIENT",
4147
"SQL_USER",
4248
"SQL_PASSWORD",
4349
"SQL_DATABASE",
50+
"SQL_PORT",
4451
"INSTANCE_CONNECTION_NAME"
4552
],
4653
"msg": "Last 10 visits:",
4754
"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",
4855
"args": [
4956
"server.js"
5057
]
58+
},
59+
"build": {
60+
"requiredEnvVars": [
61+
"SQL_CLIENT",
62+
"SQL_USER",
63+
"SQL_PASSWORD",
64+
"SQL_DATABASE",
65+
"SQL_PORT",
66+
"INSTANCE_CONNECTION_NAME"
67+
]
5168
}
5269
}
5370
}

appengine/datastore/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
},
2424
"dependencies": {
2525
"@google-cloud/datastore": "1.1.0",
26-
"express": "4.15.3"
26+
"express": "4.15.4"
2727
},
2828
"devDependencies": {
29-
"@google-cloud/nodejs-repo-tools": "1.4.16"
29+
"@google-cloud/nodejs-repo-tools": "1.4.17"
3030
},
3131
"cloud-repo-tools": {
3232
"test": {

appengine/endpoints/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"dependencies": {
2727
"body-parser": "1.17.2",
28-
"express": "4.15.3",
28+
"express": "4.15.4",
2929
"safe-buffer": "5.1.1"
3030
},
3131
"devDependencies": {

appengine/errorreporting/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
},
2525
"dependencies": {
2626
"@google-cloud/error-reporting": "0.2.1",
27-
"express": "4.15.3"
27+
"express": "4.15.4"
2828
},
2929
"devDependencies": {
30-
"@google-cloud/nodejs-repo-tools": "1.4.16",
30+
"@google-cloud/nodejs-repo-tools": "1.4.17",
3131
"ava": "0.21.0",
3232
"proxyquire": "1.8.0",
33-
"sinon": "3.0.0"
33+
"sinon": "3.2.0"
3434
},
3535
"cloud-repo-tools": {
3636
"test": {

appengine/hello-world/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
"e2e-test": "samples test deploy"
2323
},
2424
"dependencies": {
25-
"express": "4.15.3"
25+
"express": "4.15.4"
2626
},
2727
"devDependencies": {
28-
"@google-cloud/nodejs-repo-tools": "1.4.16"
28+
"@google-cloud/nodejs-repo-tools": "1.4.17"
2929
},
3030
"cloud-repo-tools": {
3131
"test": {

appengine/mailjet/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
},
2424
"dependencies": {
2525
"body-parser": "1.17.2",
26-
"express": "4.15.3",
26+
"express": "4.15.4",
2727
"jade": "1.11.0",
2828
"node-mailjet": "3.2.1"
2929
},
3030
"devDependencies": {
31-
"@google-cloud/nodejs-repo-tools": "1.4.16"
31+
"@google-cloud/nodejs-repo-tools": "1.4.17"
3232
},
3333
"cloud-repo-tools": {
3434
"test": {

appengine/mongodb/package.json

+25-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,31 @@
88
"engines": {
99
"node": ">=4.3.2"
1010
},
11+
"scripts": {
12+
"start": "node server.js",
13+
"test": "samples test app"
14+
},
15+
"cloud-repo-tools": {
16+
"test": {
17+
"app": {
18+
"requiredEnvVars": [
19+
"mongoHost",
20+
"mongoPort",
21+
"mongoUser",
22+
"mongoPassword"
23+
],
24+
"msg": "IPs:\n::1;",
25+
"args": [
26+
"server.js"
27+
]
28+
}
29+
}
30+
},
1131
"dependencies": {
12-
"nconf": "0.8.4",
13-
"mongodb": "2.2.22"
32+
"mongodb": "2.2.31",
33+
"nconf": "0.8.4"
34+
},
35+
"devDependencies": {
36+
"@google-cloud/nodejs-repo-tools": "^1.4.17"
1437
}
1538
}

appengine/mongodb/server.js

-3
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,10 @@ const port = nconf.get('mongoPort');
3434

3535
// [START client]
3636
let uri = `mongodb://${user}:${pass}@${host}:${port}`;
37-
3837
if (nconf.get('mongoDatabase')) {
3938
uri = `${uri}/${nconf.get('mongoDatabase')}`;
4039
}
4140

42-
console.log(uri);
43-
4441
mongodb.MongoClient.connect(uri, (err, db) => {
4542
if (err) {
4643
throw err;

appengine/pubsub/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Before you can run or deploy the sample, you will need to do the following:
99
1. Enable the Cloud Pub/Sub API in the [Google Developers Console](https://console.developers.google.com/project/_/apiui/apiview/pubsub/overview).
1010
1. Create a topic and subscription.
1111

12-
gcloud alpha pubsub topics create <your-topic-name>
13-
gcloud alpha pubsub subcriptions create <your-subscription-name> \
12+
gcloud beta pubsub topics create <your-topic-name>
13+
gcloud beta pubsub subcriptions create <your-subscription-name> \
1414
--topic <your-topic-name> \
1515
--push-endpoint \
1616
https://<your-project-id>.appspot.com/pubsub/push?token=<your-verification-token> \

appengine/pubsub/app.js

+5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
const express = require('express');
2020
const bodyParser = require('body-parser');
21+
const path = require('path');
2122
const Buffer = require('safe-buffer').Buffer;
23+
const process = require('process'); // Required for mocking environment variables
2224

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

3335
const app = express();
3436
app.set('view engine', 'pug');
37+
app.set('views', path.join(__dirname, 'views'));
3538

3639
const formBodyParser = bodyParser.urlencoded({ extended: false });
3740
const jsonBodyParser = bodyParser.json();
@@ -91,3 +94,5 @@ app.listen(PORT, () => {
9194
console.log('Press Ctrl+C to quit.');
9295
});
9396
// [END app]
97+
98+
module.exports = app;

appengine/pubsub/app.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ env: flex
1717

1818
# [START env]
1919
env_variables:
20-
PUBSUB_TOPIC: <your-topic-name>
20+
PUBSUB_TOPIC: YOUR_TOPIC_NAME
2121
# This token is used to verify that requests originate from your
2222
# application. It can be any sufficiently random string.
23-
PUBSUB_VERIFICATION_TOKEN: <your-verification-token>
23+
PUBSUB_VERIFICATION_TOKEN: YOUR_VERIFICATION_TOKEN
2424
# [END env]
2525
# [END app_yaml]

appengine/pubsub/package.json

+32-6
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,39 @@
99
"node": ">=4.3.2"
1010
},
1111
"scripts": {
12-
"start": "node app.js"
12+
"start": "node app.js",
13+
"test": "samples test app && ava -T 30s */*.test.js"
1314
},
1415
"dependencies": {
15-
"@google-cloud/pubsub": "0.8.0",
16-
"body-parser": "1.16.0",
17-
"express": "4.14.1",
18-
"pug": "2.0.0-beta6",
19-
"safe-buffer": "5.0.1"
16+
"@google-cloud/pubsub": "0.13.2",
17+
"body-parser": "1.17.2",
18+
"express": "4.15.4",
19+
"pug": "2.0.0-rc.3",
20+
"safe-buffer": "5.1.1"
21+
},
22+
"devDependencies": {
23+
"@google-cloud/nodejs-repo-tools": "1.4.17",
24+
"ava": "0.22.0",
25+
"uuid": "3.1.0"
26+
},
27+
"cloud-repo-tools": {
28+
"requiresProjectId": true,
29+
"requiresKeyFile": true,
30+
"test": {
31+
"app": {
32+
"requiredEnvVars": [
33+
"PUBSUB_TOPIC",
34+
"PUBSUB_VERIFICATION_TOKEN"
35+
],
36+
"msg": "Messages received by this instance",
37+
"substitutions": "YOUR_TOPIC_NAME=$PUBSUB_TOPIC,YOUR_VERIFICATION_TOKEN=$PUBSUB_VERIFICATION_TOKEN"
38+
},
39+
"build": {
40+
"requiredEnvVars": [
41+
"PUBSUB_TOPIC",
42+
"PUBSUB_VERIFICATION_TOKEN"
43+
]
44+
}
45+
}
2046
}
2147
}

appengine/pubsub/test/app.test.js

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright 2017, Google, Inc.
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
// NOTE:
15+
// This app can only be fully tested when deployed, because
16+
// Pub/Sub requires a live endpoint URL to hit. Nevertheless,
17+
// these tests mock it and partially test it locally.
18+
19+
'use strict';
20+
21+
const test = require(`ava`);
22+
const path = require(`path`);
23+
const utils = require(`@google-cloud/nodejs-repo-tools`);
24+
25+
const message = `This is a test message sent at: `;
26+
const payload = message + Date.now();
27+
28+
const cwd = path.join(__dirname, `../`);
29+
const requestObj = utils.getRequest({ cwd: cwd });
30+
31+
test.serial.cb(`should send a message to Pub/Sub`, (t) => {
32+
requestObj
33+
.post(`/`)
34+
.type('form')
35+
.send({ payload: payload })
36+
.expect(200)
37+
.expect((response) => {
38+
t.is(response.text, `Message sent`);
39+
})
40+
.end(t.end);
41+
});
42+
43+
test.serial.cb(`should receive incoming Pub/Sub messages`, (t) => {
44+
requestObj
45+
.post(`/pubsub/push`)
46+
.query({ token: process.env.PUBSUB_VERIFICATION_TOKEN })
47+
.send({
48+
message: {
49+
data: payload
50+
}
51+
})
52+
.expect(200)
53+
.end(t.end);
54+
});
55+
56+
test.serial.cb(`should check for verification token on incoming Pub/Sub messages`, (t) => {
57+
requestObj
58+
.post(`/pubsub/push`)
59+
.field(`payload`, payload)
60+
.expect(400)
61+
.end(t.end);
62+
});
63+
64+
test.serial.cb(`should list sent Pub/Sub messages`, (t) => {
65+
requestObj
66+
.get(`/`)
67+
.expect(200)
68+
.expect((response) => {
69+
t.regex(response.text, /Messages received by this instance/);
70+
})
71+
.end(t.end);
72+
});

appengine/static-files/package.json

+15-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,22 @@
99
"node": ">=4.3.2"
1010
},
1111
"scripts": {
12-
"start": "node app.js"
12+
"start": "node app.js",
13+
"test": "samples test app --url localhost:8080/static/main.css"
14+
},
15+
"cloud-repo-tools": {
16+
"test": {
17+
"app": {
18+
"msg": "background-color",
19+
"port": 8080
20+
}
21+
}
1322
},
1423
"dependencies": {
15-
"express": "4.14.1",
16-
"pug": "2.0.0-beta6"
24+
"express": "4.15.4",
25+
"pug": "2.0.0-rc.3"
26+
},
27+
"devDependencies": {
28+
"@google-cloud/nodejs-repo-tools": "1.4.17"
1729
}
1830
}

0 commit comments

Comments
 (0)