Skip to content

Commit

Permalink
tests: ci: allow parallel npm installs (#1596)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus authored and callmehiphop committed Sep 19, 2016
1 parent 35573c3 commit af8ca8d
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 48 deletions.
26 changes: 22 additions & 4 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
environment:
matrix:
- nodejs_version: "0.12"
- nodejs_version: "4"
- nodejs_version: "6"
- nodejs_version: 0.12
- nodejs_version: 4
- nodejs_version: 6

GCLOUD_TESTS_KEY: 'key.appveyor.json'
GCLOUD_TESTS_KEY: key.appveyor.json
GCLOUD_TESTS_KEY_SECRET:
secure: usGkvXjqCzDNIQHx8oEncrZOmez7GBocB1EXM+g/9rw=

cache:
- '%APPDATA%\npm-cache'
- node_modules -> package.json
- packages\bigquery\node_modules -> packages\bigquery\package.json
- packages\bigtable\node_modules -> packages\bigtable\package.json
- packages\compute\node_modules -> packages\compute\package.json
- packages\datastore\node_modules -> packages\datastore\package.json
- packages\dns\node_modules -> packages\dns\package.json
- packages\google-cloud\node_modules -> packages\google-cloud\package.json
- packages\language\node_modules -> packages\language\package.json
- packages\logging\node_modules -> packages\logging\package.json
- packages\prediction\node_modules -> packages\prediction\package.json
- packages\pubsub\node_modules -> packages\pubsub\package.json
- packages\resource\node_modules -> packages\resource\package.json
- packages\storage\node_modules -> packages\storage\package.json
- packages\translate\node_modules -> packages\translate\package.json
- packages\vision\node_modules -> packages\vision\package.json

install:
- ps: Install-Product node $env:nodejs_version
- ps: >-
Expand Down
21 changes: 19 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
language: node_js
node_js:
- 6
- 4
- 0.12
- 4
- 6
cache:
directories:
- node_modules
- packages/bigquery/node_modules
- packages/bigtable/node_modules
- packages/compute/node_modules
- packages/datastore/node_modules
- packages/dns/node_modules
- packages/google-cloud/node_modules
- packages/language/node_modules
- packages/logging/node_modules
- packages/prediction/node_modules
- packages/pubsub/node_modules
- packages/resource/node_modules
- packages/storage/node_modules
- packages/translate/node_modules
- packages/vision/node_modules
os:
- linux
- osx
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"mitm": "^1.1.0",
"mkdirp": "^0.5.1",
"mocha": "^2.5.3",
"propprop": "^0.3.0",
"propprop": "^0.3.1",
"proxyquire": "^1.7.10",
"request": "^2.70.0",
"semver": "^5.3.0",
Expand Down
64 changes: 32 additions & 32 deletions packages/storage/test/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ describe('File', function() {

it('should create a signed policy', function(done) {
file.getSignedPolicy({
expires: Date.now() + 5
expires: Date.now() + 2000
}, function(err, signedPolicy) {
assert.ifError(err);
assert.equal(typeof signedPolicy.string, 'string');
Expand All @@ -1445,7 +1445,7 @@ describe('File', function() {

it('should not modify the configuration object', function(done) {
var config = {
expires: Date.now() + 5
expires: Date.now() + 2000
};

var originalConfig = extend({}, config);
Expand All @@ -1466,7 +1466,7 @@ describe('File', function() {
};

file.getSignedPolicy({
expires: Date.now() + 5
expires: Date.now() + 2000
}, function(err) {
assert.strictEqual(err.name, 'SigningError');
assert.strictEqual(err.message, error.message);
Expand All @@ -1481,7 +1481,7 @@ describe('File', function() {
};

file.getSignedPolicy({
expires: Date.now() + 5
expires: Date.now() + 2000
}, function(err) {
var errorMessage = [
'Could not find a `private_key`.',
Expand All @@ -1496,7 +1496,7 @@ describe('File', function() {

it('should add key equality condition', function(done) {
file.getSignedPolicy({
expires: Date.now() + 5
expires: Date.now() + 2000
}, function(err, signedPolicy) {
var conditionString = '[\"eq\",\"$key\",\"' + file.name + '\"]';
assert.ifError(err);
Expand All @@ -1507,7 +1507,7 @@ describe('File', function() {

it('should add ACL condtion', function(done) {
file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
acl: '<acl>'
}, function(err, signedPolicy) {
var conditionString = '{\"acl\":\"<acl>\"}';
Expand All @@ -1521,7 +1521,7 @@ describe('File', function() {
var redirectUrl = 'http://redirect';

file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
successRedirect: redirectUrl
}, function(err, signedPolicy) {
assert.ifError(err);
Expand All @@ -1539,7 +1539,7 @@ describe('File', function() {
var successStatus = '200';

file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
successStatus: successStatus
}, function(err, signedPolicy) {
assert.ifError(err);
Expand Down Expand Up @@ -1607,7 +1607,7 @@ describe('File', function() {
describe('equality condition', function() {
it('should add equality conditions (array of arrays)', function(done) {
file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
equals: [['$<field>', '<value>']]
}, function(err, signedPolicy) {
var conditionString = '[\"eq\",\"$<field>\",\"<value>\"]';
Expand All @@ -1619,7 +1619,7 @@ describe('File', function() {

it('should add equality condition (array)', function(done) {
file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
equals: ['$<field>', '<value>']
}, function(err, signedPolicy) {
var conditionString = '[\"eq\",\"$<field>\",\"<value>\"]';
Expand All @@ -1632,7 +1632,7 @@ describe('File', function() {
it('should throw if equal condition is not an array', function() {
assert.throws(function() {
file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
equals: [{}]
}, function() {});
}, /Equals condition must be an array of 2 elements\./);
Expand All @@ -1641,7 +1641,7 @@ describe('File', function() {
it('should throw if equal condition length is not 2', function() {
assert.throws(function() {
file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
equals: [['1', '2', '3']]
}, function() {});
}, /Equals condition must be an array of 2 elements\./);
Expand All @@ -1651,7 +1651,7 @@ describe('File', function() {
describe('prefix conditions', function() {
it('should add prefix conditions (array of arrays)', function(done) {
file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
startsWith: [['$<field>', '<value>']]
}, function(err, signedPolicy) {
var conditionString = '[\"starts-with\",\"$<field>\",\"<value>\"]';
Expand All @@ -1663,7 +1663,7 @@ describe('File', function() {

it('should add prefix condition (array)', function(done) {
file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
startsWith: ['$<field>', '<value>']
}, function(err, signedPolicy) {
var conditionString = '[\"starts-with\",\"$<field>\",\"<value>\"]';
Expand All @@ -1676,7 +1676,7 @@ describe('File', function() {
it('should throw if prexif condition is not an array', function() {
assert.throws(function() {
file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
startsWith: [{}]
}, function() {});
}, /StartsWith condition must be an array of 2 elements\./);
Expand All @@ -1685,7 +1685,7 @@ describe('File', function() {
it('should throw if prefix condition length is not 2', function() {
assert.throws(function() {
file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
startsWith: [['1', '2', '3']]
}, function() {});
}, /StartsWith condition must be an array of 2 elements\./);
Expand All @@ -1695,7 +1695,7 @@ describe('File', function() {
describe('content length', function() {
it('should add content length condition', function(done) {
file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
contentLengthRange: {min: 0, max: 1}
}, function(err, signedPolicy) {
var conditionString = '[\"content-length-range\",0,1]';
Expand All @@ -1708,7 +1708,7 @@ describe('File', function() {
it('should throw if content length has no min', function() {
assert.throws(function() {
file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
contentLengthRange: [{max: 1}]
}, function() {});
}, /ContentLengthRange must have numeric min & max fields\./);
Expand All @@ -1717,7 +1717,7 @@ describe('File', function() {
it('should throw if content length has no max', function() {
assert.throws(function() {
file.getSignedPolicy({
expires: Date.now() + 5,
expires: Date.now() + 2000,
contentLengthRange: [{min: 0}]
}, function() {});
}, /ContentLengthRange must have numeric min & max fields\./);
Expand All @@ -1738,7 +1738,7 @@ describe('File', function() {
it('should create a signed url', function(done) {
file.getSignedUrl({
action: 'read',
expires: Date.now() + 5
expires: Date.now() + 2000
}, function(err, signedUrl) {
assert.ifError(err);
assert.equal(typeof signedUrl, 'string');
Expand All @@ -1749,7 +1749,7 @@ describe('File', function() {
it('should not modify the configuration object', function(done) {
var config = {
action: 'read',
expires: Date.now() + 5
expires: Date.now() + 2000
};

var originalConfig = extend({}, config);
Expand All @@ -1771,7 +1771,7 @@ describe('File', function() {

file.getSignedUrl({
action: 'read',
expires: Date.now() + 5
expires: Date.now() + 2000
}, function(err) {
assert.strictEqual(err.name, 'SigningError');
assert.strictEqual(err.message, error.message);
Expand All @@ -1787,7 +1787,7 @@ describe('File', function() {

file.getSignedUrl({
action: 'read',
expires: Date.now() + 5
expires: Date.now() + 2000
}, function(err) {
var errorMessage = [
'Could not find a `private_key` or `client_email`.',
Expand All @@ -1803,7 +1803,7 @@ describe('File', function() {
it('should URI encode file names', function(done) {
directoryFile.getSignedUrl({
action: 'read',
expires: Date.now() + 5,
expires: Date.now() + 2000,
}, function(err, signedUrl) {
assert(signedUrl.indexOf(encodeURIComponent(directoryFile.name)) > -1);
done();
Expand All @@ -1814,7 +1814,7 @@ describe('File', function() {
var type = 'application/json';
directoryFile.getSignedUrl({
action: 'read',
expires: Date.now() + 5,
expires: Date.now() + 2000,
responseType: type
}, function(err, signedUrl) {
assert(signedUrl.indexOf(encodeURIComponent(type)) > -1);
Expand All @@ -1827,7 +1827,7 @@ describe('File', function() {
var file = new File(BUCKET, 'name', { generation: generation });
file.getSignedUrl({
action: 'read',
expires: Date.now() + 5,
expires: Date.now() + 2000,
}, function(err, signedUrl) {
assert(signedUrl.indexOf(encodeURIComponent(generation)) > -1);
done();
Expand All @@ -1841,7 +1841,7 @@ describe('File', function() {
file.getSignedUrl({
action: 'read',
cname: host,
expires: Date.now() + 5
expires: Date.now() + 2000
}, function(err, signedUrl) {
assert.ifError(err);
assert.strictEqual(signedUrl.indexOf(host), 0);
Expand All @@ -1855,7 +1855,7 @@ describe('File', function() {
file.getSignedUrl({
action: 'read',
cname: host,
expires: Date.now() + 5
expires: Date.now() + 2000
}, function(err, signedUrl) {
assert.ifError(err);
assert.strictEqual(signedUrl.indexOf(host), -1);
Expand All @@ -1870,7 +1870,7 @@ describe('File', function() {
var disposition = 'attachment; filename="fname.ext"';
directoryFile.getSignedUrl({
action: 'read',
expires: Date.now() + 5,
expires: Date.now() + 2000,
promptSaveAs: 'fname.ext'
}, function(err, signedUrl) {
assert(signedUrl.indexOf(disposition) > -1);
Expand All @@ -1884,7 +1884,7 @@ describe('File', function() {
var disposition = 'attachment; filename="fname.ext"';
directoryFile.getSignedUrl({
action: 'read',
expires: Date.now() + 5,
expires: Date.now() + 2000,
responseDisposition: disposition
}, function(err, signedUrl) {
assert(signedUrl.indexOf(encodeURIComponent(disposition)) > -1);
Expand All @@ -1897,7 +1897,7 @@ describe('File', function() {
var saveAs = 'fname2.ext';
directoryFile.getSignedUrl({
action: 'read',
expires: Date.now() + 5,
expires: Date.now() + 2000,
promptSaveAs: saveAs,
responseDisposition: disposition
}, function(err, signedUrl) {
Expand Down Expand Up @@ -1973,7 +1973,7 @@ describe('File', function() {
'x-foo': 'bar'
};

var expires = Date.now() + 5;
var expires = Date.now() + 2000;
var expiresInSeconds = Math.round(expires / 1000);
var name = encodeURIComponent(directoryFile.name);
var resource = '/' + directoryFile.bucket.name + '/' + name;
Expand Down
Loading

0 comments on commit af8ca8d

Please sign in to comment.