Skip to content

Commit

Permalink
fix: extend supported gRPC version range to 1.8 (googleapis#630)
Browse files Browse the repository at this point in the history
* Bump supported gRPC version range to 1.8
* Change gRPC fixture versions to be `~` instead of `^` (to fix CI failure after gRPC 1.8 was released)
* datastore test: Change checked error code from HTTP 401 (unauthorized) to gRPC 16 (unauthenticated) -- reflects change in gRPC 1.8
* For convenince, add `npm run script` npm script
  • Loading branch information
kjin authored Jan 4, 2018
1 parent 9866d29 commit 3b1cd24
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 53 deletions.
71 changes: 34 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
"types": "build/src/index.d.ts",
"repository": "GoogleCloudPlatform/cloud-trace-nodejs",
"scripts": {
"test": "ts-node -P ./scripts ./scripts npm-check npm-compile init-test-fixtures run-unit-tests",
"non-interference": "ts-node -P ./scripts ./scripts npm-compile test-non-interference",
"system-test": "ts-node -P ./scripts ./scripts npm-compile decrypt-service-account-key run-system-tests",
"test": "npm run script npm-check npm-compile init-test-fixtures run-unit-tests",
"non-interference": "npm run script npm-compile test-non-interference",
"system-test": "npm run script npm-compile decrypt-service-account-key run-system-tests",
"changelog": "./bin/run-changelog.sh",
"check-install": "ts-node -P ./scripts ./scripts npm-compile check-install",
"coverage": "ts-node -P ./scripts ./scripts npm-check npm-compile init-test-fixtures run-unit-tests-with-coverage report-coverage",
"check-install": "npm run script npm-compile check-install",
"coverage": "npm run script npm-check npm-compile init-test-fixtures run-unit-tests-with-coverage report-coverage",
"bump": "./bin/run-bump.sh",
"check": "gts check",
"clean": "gts clean",
"compile-all": "tsc -p ./tsconfig.full.json",
"compile-strict": "tsc -p .",
"compile": "ts-node -P ./scripts ./scripts npm-compile-all npm-compile-strict",
"compile": "npm run script npm-compile-all npm-compile-strict",
"fix": "gts fix",
"prepare": "ts-node -P ./scripts ./scripts npm-clean npm-compile"
"prepare": "npm run script npm-clean npm-compile",
"script": "ts-node -P ./scripts ./scripts"
},
"files": [
"build/src/*.js",
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/plugin-grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,19 +495,19 @@ module.exports = [
},
{
file: 'src/client.js',
versions: '1.7',
versions: '1.7 - 1.8',
patch: patchClient,
unpatch: unpatchClient
},
{
file: 'src/metadata.js',
versions: '1.7',
versions: '1.7 - 1.8',
patch: patchMetadata,
unpatch: unpatchMetadata
},
{
file: 'src/server.js',
versions: '1.7',
versions: '1.7 - 1.8',
patch: patchServer,
unpatch: unpatchServer
}
Expand Down
2 changes: 1 addition & 1 deletion test/plugins/fixtures/grpc1.6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"grpc": "^1.6.0"
"grpc": "~1.6.0"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "grpc1.7",
"name": "grpc1.8",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"grpc": "1.7.0-pre1"
"grpc": "~1.8.0"
}
}
2 changes: 1 addition & 1 deletion test/plugins/test-trace-datastore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('test-trace-datastore', function() {
ds.get(key, function(err, entity) {
endTransaction();
assert(err);
assert.strictEqual(err.code, 401);
assert.strictEqual(err.code, 16); // 16 = Status.UNAUTHENTICATED
assert.notStrictEqual(
err.message.indexOf('accounts.google.com:443/o/oauth2/token'), -1);
var trace = common.getMatchingSpan(grpcPredicate);
Expand Down
2 changes: 1 addition & 1 deletion test/plugins/test-trace-grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var common = require('./common'/*.js*/);

var versions = {
grpc1_6: './fixtures/grpc1.6',
grpc1_7: './fixtures/grpc1.7'
grpc1_8: './fixtures/grpc1.8'
};

var protoFile = __dirname + '/../fixtures/test-grpc.proto';
Expand Down
2 changes: 1 addition & 1 deletion test/test-grpc-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var http = require('http');

var versions = {
grpc1_6: './plugins/fixtures/grpc1.6',
grpc1_7: './plugins/fixtures/grpc1.7'
grpc1_8: './plugins/fixtures/grpc1.8'
};

var grpcPort = 50051;
Expand Down

0 comments on commit 3b1cd24

Please sign in to comment.