Skip to content

Commit 1e17f80

Browse files
author
Ace Nassri
authored
Travis: fix failing tests + update dependencies (GoogleCloudPlatform#335)
* Make unify script recursive + clean up dependency conflicts * Restore travis.yml * Delete outdated text detection sample that duplicates detect.js * Fix failing KMS + vision tests by updating dependencies * Fix video tests using a bad cwd * Upgrade monitoring dependency + skip flaky monitoring tests * Fix DLP tests having wrong cwd * Fix failing vision test * Fix datastore tests * Update broken dependency * Update possibly broken compute engine dependency * Fix typos * Disable Node 4 testing * Revert deletion of outdated sample - @gguuss says we still use this. This reverts commit b7259c8. * Update dependency
1 parent 02b97b1 commit 1e17f80

File tree

26 files changed

+6428
-836
lines changed

26 files changed

+6428
-836
lines changed

.travis.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright 2015-2016, 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+
sudo: false
15+
language: node_js
16+
node_js:
17+
- "6"
18+
19+
cache:
20+
directories:
21+
- node_modules/
22+
23+
env:
24+
global:
25+
- GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/key.json
26+
- TEST_BUCKET_NAME=nodejs-docs-samples
27+
- GCLOUD_PROJECT=nodejs-docs-samples
28+
29+
before_install:
30+
- openssl aes-256-cbc -K $encrypted_fda0b707c7d5_key -iv $encrypted_fda0b707c7d5_iv -in key.json.enc -out key.json -d
31+
- npm install -g npm
32+
- npm set progress=false
33+
34+
before_script:
35+
- node scripts/install
36+
37+
script: npm test

appengine/grunt/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
"grunt": "1.0.1",
2121
"grunt-cli": "1.2.0",
2222
"grunt-contrib-clean": "1.0.0",
23-
"grunt-contrib-cssmin": "1.0.2",
23+
"grunt-contrib-cssmin": "2.0.0",
2424
"grunt-contrib-jshint": "1.1.0",
2525
"grunt-contrib-watch": "1.0.0",
26-
"morgan": "1.7.0",
26+
"morgan": "1.8.0",
2727
"pug": "2.0.0-beta6",
2828
"serve-favicon": "2.3.2"
2929
}

appengine/loopback/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"helmet": "1.3.0",
2121
"loopback-boot": "2.6.5",
2222
"loopback-component-explorer": "2.4.0",
23-
"serve-favicon": "2.0.1",
23+
"serve-favicon": "2.3.2",
2424
"strong-error-handler": "1.0.1",
2525
"loopback-datasource-juggler": "2.39.0",
2626
"loopback": "2.22.0"

appengine/sails/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"grunt-contrib-coffee": "0.13.0",
2020
"grunt-contrib-concat": "0.5.1",
2121
"grunt-contrib-copy": "0.8.1",
22-
"grunt-contrib-cssmin": "0.14.0",
22+
"grunt-contrib-cssmin": "2.0.0",
2323
"grunt-contrib-jst": "0.6.0",
2424
"grunt-contrib-less": "1.0.1",
2525
"grunt-contrib-uglify": "0.9.2",

computeengine/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"system-test": "cd ..; npm run t -- computeengine/system-test/*.test.js"
1010
},
1111
"dependencies": {
12-
"@google-cloud/compute": "0.5.0",
13-
"googleapis": "16.1.0",
12+
"@google-cloud/compute": "0.6.0",
13+
"googleapis": "18.0.0",
1414
"nodemailer": "2.7.0",
1515
"nodemailer-smtp-transport": "2.7.2",
1616
"sendgrid": "4.7.1"

datastore/concepts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ class Metadata extends TestHelper {
510510
return runNamespaceQuery(startNamespace, endNamespace);
511511
})
512512
.then((namespaces) => {
513-
t.deepEqual(namespaces, ['Animals']);
513+
t.true(namespaces.includes('Animals'));
514514
});
515515
}
516516

datastore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"test": "cd ..; npm run st -- --verbose datastore/system-test/*.test.js"
99
},
1010
"dependencies": {
11-
"@google-cloud/datastore": "0.7.0",
11+
"@google-cloud/datastore": "0.8.0",
1212
"yargs": "6.6.0"
1313
},
1414
"engines": {

datastore/system-test/quickstart.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ const entity = { description: `Buy milk` };
2323
const kind = `Task`;
2424
const name = `sampletask1`;
2525
const key = datastore.key([kind, name]);
26+
const datastoreEntity = Object.assign({}, entity);
27+
datastoreEntity[datastore.KEY] = key;
2628

2729
test.before(async () => {
2830
try {
@@ -52,7 +54,7 @@ test.cb(`should get a task from Datastore`, (t) => {
5254
setTimeout(() => {
5355
datastore.get(key)
5456
.then(([task]) => {
55-
t.deepEqual(task, entity);
57+
t.deepEqual(task, datastoreEntity);
5658
t.true(console.log.calledWith(`Saved ${name}: ${entity.description}`));
5759
t.end();
5860
})

dlp/system-test/inspect.test.js

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,102 +16,104 @@
1616
'use strict';
1717

1818
require(`../../system-test/_setup`);
19+
const path = require('path');
1920

2021
const cmd = 'node inspect';
22+
const cwd = path.join(__dirname, `..`);
2123

2224
// inspect_string
2325
test(`should inspect a string`, async (t) => {
24-
const output = await runAsync(`${cmd} string "I'm Gary and my email is gary@example.com"`);
26+
const output = await runAsync(`${cmd} string "I'm Gary and my email is gary@example.com"`, cwd);
2527
t.regex(output, /"name": "EMAIL_ADDRESS"/);
2628
});
2729

2830
test(`should handle a string with no sensitive data`, async (t) => {
29-
const output = await runAsync(`${cmd} string "foo"`);
31+
const output = await runAsync(`${cmd} string "foo"`, cwd);
3032
t.is(output, 'undefined');
3133
});
3234

3335
test(`should report string inspection handling errors`, async (t) => {
34-
const output = await runAsync(`${cmd} string "I'm Gary and my email is gary@example.com" -a foo`);
36+
const output = await runAsync(`${cmd} string "I'm Gary and my email is gary@example.com" -a foo`, cwd);
3537
t.regex(output, /Error in inspectString/);
3638
});
3739

3840
// inspect_file
3941
test(`should inspect a local text file`, async (t) => {
40-
const output = await runAsync(`${cmd} file resources/test.txt`);
42+
const output = await runAsync(`${cmd} file resources/test.txt`, cwd);
4143
t.regex(output, /"name": "PHONE_NUMBER"/);
4244
t.regex(output, /"name": "EMAIL_ADDRESS"/);
4345
});
4446

4547
test(`should inspect a local image file`, async (t) => {
46-
const output = await runAsync(`${cmd} file resources/test.png`);
48+
const output = await runAsync(`${cmd} file resources/test.png`, cwd);
4749
t.regex(output, /"name": "PHONE_NUMBER"/);
4850
});
4951

5052
test(`should handle a local file with no sensitive data`, async (t) => {
51-
const output = await runAsync(`${cmd} file resources/harmless.txt`);
53+
const output = await runAsync(`${cmd} file resources/harmless.txt`, cwd);
5254
t.is(output, 'undefined');
5355
});
5456

5557
test(`should report local file handling errors`, async (t) => {
56-
const output = await runAsync(`${cmd} file resources/harmless.txt -a foo`);
58+
const output = await runAsync(`${cmd} file resources/harmless.txt -a foo`, cwd);
5759
t.regex(output, /Error in inspectFile/);
5860
});
5961

6062
// inspect_gcs_file
6163
test.serial(`should inspect a GCS text file`, async (t) => {
62-
const output = await runAsync(`${cmd} gcsFile nodejs-docs-samples-dlp test.txt`);
64+
const output = await runAsync(`${cmd} gcsFile nodejs-docs-samples-dlp test.txt`, cwd);
6365
t.regex(output, /"name": "PHONE_NUMBER"/);
6466
t.regex(output, /"name": "EMAIL_ADDRESS"/);
6567
});
6668

6769
test.serial(`should inspect multiple GCS text files`, async (t) => {
68-
const output = await runAsync(`${cmd} gcsFile nodejs-docs-samples-dlp *.txt`);
70+
const output = await runAsync(`${cmd} gcsFile nodejs-docs-samples-dlp *.txt`, cwd);
6971
t.regex(output, /"name": "PHONE_NUMBER"/);
7072
t.regex(output, /"name": "EMAIL_ADDRESS"/);
7173
t.regex(output, /"name": "CREDIT_CARD_NUMBER"/);
7274
});
7375

7476
test.serial(`should accept try limits for inspecting GCS files`, async (t) => {
75-
const output = await runAsync(`${cmd} gcsFile nodejs-docs-samples-dlp test.txt --tries 0`);
77+
const output = await runAsync(`${cmd} gcsFile nodejs-docs-samples-dlp test.txt --tries 0`, cwd);
7678
t.regex(output, /polling timed out/);
7779
});
7880

7981
test.serial(`should handle a GCS file with no sensitive data`, async (t) => {
80-
const output = await runAsync(`${cmd} gcsFile nodejs-docs-samples-dlp harmless.txt`);
82+
const output = await runAsync(`${cmd} gcsFile nodejs-docs-samples-dlp harmless.txt`, cwd);
8183
t.is(output, 'undefined');
8284
});
8385

8486
test.serial(`should report GCS file handling errors`, async (t) => {
85-
const output = await runAsync(`${cmd} gcsFile nodejs-docs-samples-dlp harmless.txt -a foo`);
87+
const output = await runAsync(`${cmd} gcsFile nodejs-docs-samples-dlp harmless.txt -a foo`, cwd);
8688
t.regex(output, /Error in inspectGCSFile/);
8789
});
8890

8991
// inspect_datastore
9092
test.serial(`should inspect Datastore`, async (t) => {
91-
const output = await runAsync(`${cmd} datastore Person --namespaceId DLP`);
93+
const output = await runAsync(`${cmd} datastore Person --namespaceId DLP`, cwd);
9294
t.regex(output, /"name": "PHONE_NUMBER"/);
9395
t.regex(output, /"name": "EMAIL_ADDRESS"/);
9496
});
9597

9698
test.serial(`should accept try limits for inspecting Datastore`, async (t) => {
97-
const output = await runAsync(`${cmd} datastore Person --namespaceId DLP --tries 0`);
99+
const output = await runAsync(`${cmd} datastore Person --namespaceId DLP --tries 0`, cwd);
98100
t.regex(output, /polling timed out/);
99101
});
100102

101103
test.serial(`should handle Datastore with no sensitive data`, async (t) => {
102-
const output = await runAsync(`${cmd} datastore Harmless --namespaceId DLP`);
104+
const output = await runAsync(`${cmd} datastore Harmless --namespaceId DLP`, cwd);
103105
t.is(output, 'undefined');
104106
});
105107

106108
test.serial(`should report Datastore file handling errors`, async (t) => {
107-
const output = await runAsync(`${cmd} datastore Harmless --namespaceId DLP -a foo`);
109+
const output = await runAsync(`${cmd} datastore Harmless --namespaceId DLP -a foo`, cwd);
108110
t.regex(output, /Error in inspectDatastore/);
109111
});
110112

111113
// CLI options
112114
test(`should have a minLikelihood option`, async (t) => {
113-
const promiseA = runAsync(`${cmd} string "My phone number is (123) 456-7890." -m POSSIBLE`);
114-
const promiseB = runAsync(`${cmd} string "My phone number is (123) 456-7890." -m UNLIKELY`);
115+
const promiseA = runAsync(`${cmd} string "My phone number is (123) 456-7890." -m POSSIBLE`, cwd);
116+
const promiseB = runAsync(`${cmd} string "My phone number is (123) 456-7890." -m UNLIKELY`, cwd);
115117

116118
const outputA = await promiseA;
117119
t.truthy(outputA);
@@ -122,8 +124,8 @@ test(`should have a minLikelihood option`, async (t) => {
122124
});
123125

124126
test(`should have a maxFindings option`, async (t) => {
125-
const promiseA = runAsync(`${cmd} string "My email is gary@example.com and my phone number is (223) 456-7890." -f 1`);
126-
const promiseB = runAsync(`${cmd} string "My email is gary@example.com and my phone number is (223) 456-7890." -f 2`);
127+
const promiseA = runAsync(`${cmd} string "My email is gary@example.com and my phone number is (223) 456-7890." -f 1`, cwd);
128+
const promiseB = runAsync(`${cmd} string "My email is gary@example.com and my phone number is (223) 456-7890." -f 2`, cwd);
127129

128130
const outputA = await promiseA;
129131
t.not(outputA.includes('PHONE_NUMBER'), outputA.includes('EMAIL_ADDRESS')); // Exactly one of these should be included
@@ -134,8 +136,8 @@ test(`should have a maxFindings option`, async (t) => {
134136
});
135137

136138
test(`should have an option to include quotes`, async (t) => {
137-
const promiseA = runAsync(`${cmd} string "My phone number is (223) 456-7890." -q false`);
138-
const promiseB = runAsync(`${cmd} string "My phone number is (223) 456-7890."`);
139+
const promiseA = runAsync(`${cmd} string "My phone number is (223) 456-7890." -q false`, cwd);
140+
const promiseB = runAsync(`${cmd} string "My phone number is (223) 456-7890."`, cwd);
139141

140142
const outputA = await promiseA;
141143
t.truthy(outputA);
@@ -146,8 +148,8 @@ test(`should have an option to include quotes`, async (t) => {
146148
});
147149

148150
test(`should have an option to filter results by infoType`, async (t) => {
149-
const promiseA = runAsync(`${cmd} string "My email is gary@example.com and my phone number is (223) 456-7890."`);
150-
const promiseB = runAsync(`${cmd} string "My email is gary@example.com and my phone number is (223) 456-7890." -t PHONE_NUMBER`);
151+
const promiseA = runAsync(`${cmd} string "My email is gary@example.com and my phone number is (223) 456-7890."`, cwd);
152+
const promiseB = runAsync(`${cmd} string "My email is gary@example.com and my phone number is (223) 456-7890." -t PHONE_NUMBER`, cwd);
151153

152154
const outputA = await promiseA;
153155
t.regex(outputA, /EMAIL_ADDRESS/);
@@ -159,7 +161,7 @@ test(`should have an option to filter results by infoType`, async (t) => {
159161
});
160162

161163
test(`should have an option for custom auth tokens`, async (t) => {
162-
const output = await runAsync(`${cmd} string "My name is Gary and my phone number is (223) 456-7890." -a foo`);
164+
const output = await runAsync(`${cmd} string "My name is Gary and my phone number is (223) 456-7890." -a foo`, cwd);
163165
t.regex(output, /Error in inspectString/);
164166
t.regex(output, /invalid authentication/);
165167
});

dlp/system-test/metadata.test.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,34 @@
1616
'use strict';
1717

1818
require(`../../system-test/_setup`);
19+
const path = require('path');
1920

20-
const cmd = `node metadata`;
21+
const cmd = 'node metadata';
22+
const cwd = path.join(__dirname, `..`);
2123

2224
test(`should list info types for a given category`, async (t) => {
23-
const output = await runAsync(`${cmd} infoTypes GOVERNMENT`);
25+
const output = await runAsync(`${cmd} infoTypes GOVERNMENT`, cwd);
2426
t.regex(output, /name: 'US_DRIVERS_LICENSE_NUMBER'/);
2527
});
2628

2729
test(`should inspect categories`, async (t) => {
28-
const output = await runAsync(`${cmd} categories`);
30+
const output = await runAsync(`${cmd} categories`, cwd);
2931
t.regex(output, /name: 'FINANCE'/);
3032
});
3133

3234
test(`should have an option for custom auth tokens`, async (t) => {
33-
const output = await runAsync(`${cmd} categories -a foo`);
35+
const output = await runAsync(`${cmd} categories -a foo`, cwd);
3436
t.regex(output, /Error in listCategories/);
3537
t.regex(output, /invalid authentication/);
3638
});
3739

3840
// Error handling
3941
test(`should report info type listing handling errors`, async (t) => {
40-
const output = await runAsync(`${cmd} infoTypes GOVERNMENT -a foo`);
42+
const output = await runAsync(`${cmd} infoTypes GOVERNMENT -a foo`, cwd);
4143
t.regex(output, /Error in listInfoTypes/);
4244
});
4345

4446
test(`should report category listing handling errors`, async (t) => {
45-
const output = await runAsync(`${cmd} categories -a foo`);
47+
const output = await runAsync(`${cmd} categories -a foo`, cwd);
4648
t.regex(output, /Error in listCategories/);
4749
});

0 commit comments

Comments
 (0)