Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: use @grpc/grpc-js instead of grpc #484

Merged
merged 8 commits into from
May 4, 2019
Merged

Conversation

alexander-fenster
Copy link
Contributor

BREAKING CHANGE

Make all client libraries use @grpc/grpc-js by default. The libraries that still want to use legacy grpc should pass the instance of grpc to client library constructor.

  • Tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 3, 2019
@alexander-fenster
Copy link
Contributor Author

Something wrong with authentication - investigating...

@codecov
Copy link

codecov bot commented May 3, 2019

Codecov Report

Merging #484 into master will decrease coverage by 0.03%.
The diff coverage is 80.95%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #484      +/-   ##
=========================================
- Coverage   82.43%   82.4%   -0.04%     
=========================================
  Files          50      50              
  Lines        3439    3416      -23     
  Branches      266     262       -4     
=========================================
- Hits         2835    2815      -20     
+ Misses        539     537       -2     
+ Partials       65      64       -1
Impacted Files Coverage Δ
src/index.ts 90.62% <ø> (ø) ⬆️
src/gax.ts 83.07% <ø> (ø) ⬆️
src/googleError.ts 100% <ø> (ø) ⬆️
...ixtures/google-gax-packaging-test-app/src/index.js 0% <0%> (ø) ⬆️
test/bundling.ts 96.35% <100%> (ø) ⬆️
src/bundlingCalls/bundleExecutor.ts 87.05% <100%> (ø) ⬆️
src/bundlingCalls/task.ts 97.75% <100%> (ø) ⬆️
test/apiCallable.ts 81.34% <100%> (ø) ⬆️
src/normalCalls/retries.ts 89.28% <100%> (ø) ⬆️
src/call.ts 86.66% <100%> (ø) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b0dbafb...2031b06. Read the comment docs.

@codecov
Copy link

codecov bot commented May 3, 2019

Codecov Report

Merging #484 into master will decrease coverage by 0.05%.
The diff coverage is 77.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #484      +/-   ##
==========================================
- Coverage   82.43%   82.38%   -0.06%     
==========================================
  Files          50       50              
  Lines        3439     3417      -22     
  Branches      266      262       -4     
==========================================
- Hits         2835     2815      -20     
+ Misses        539      538       -1     
+ Partials       65       64       -1
Impacted Files Coverage Δ
src/index.ts 90.62% <ø> (ø) ⬆️
src/gax.ts 83.07% <ø> (ø) ⬆️
src/googleError.ts 100% <ø> (ø) ⬆️
...ixtures/google-gax-packaging-test-app/src/index.js 0% <0%> (ø) ⬆️
test/bundling.ts 96.35% <100%> (ø) ⬆️
src/bundlingCalls/bundleExecutor.ts 87.05% <100%> (ø) ⬆️
src/bundlingCalls/task.ts 97.75% <100%> (ø) ⬆️
test/apiCallable.ts 81.34% <100%> (ø) ⬆️
src/normalCalls/retries.ts 89.28% <100%> (ø) ⬆️
src/call.ts 86.66% <100%> (ø) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 728678a...7948190. Read the comment docs.

@alexander-fenster
Copy link
Contributor Author

So, the authentication problem is caused by incorrect service account key (which just stopped working for some reason). I think at this point it's OK to remove the client library test (pub/sub, video intelligence, and speech), since we have an end-to-end test with a local gRPC server and it's much less fragile. When we are done will all these upgrades and semver major releases, we can put the client library system test back, but right now it will just prevent us from doing releases.

src/grpc.ts Outdated

export interface ClientStubOptions {
servicePath: string;
port: number;
sslCreds?: grpcTypes.ChannelCredentials;
// @ts-ignore waiting for grpc-js types
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this is necessary. Should sslCreds just be any until we can fix things?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to any!

src/grpc.ts Outdated
const errorMessage =
'To use @grpc/grpc-js you must run your code on Node.js v8.13.0 or newer. Please see README if you need to use an older version. ' +
'https://github.com/googleapis/gax-nodejs/blob/master/README.md';
console.error(errorMessage);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to write to the console if we're throwing, do we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wanted to communicate the error in all the ways possible :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Justin, throw is probably sufficient, as it will end up in stderr and output essentially the same message (but with stack trace).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed console.error.

* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import * as execa from 'execa';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing this as part of this PR makes me uncomfortable and nervous 😨

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the same, but this kind of testing works great for minor changes but not for breaking changes. We have a full feature coverage through the end-to-end test (the one that runs local gRPC server), and also we'll only release it as a semver major so we'll have enough time to make sure client libraries work.

I promise I'll put this back when we are done with these huge changes :)

Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me, I'm really excited to be dropping node-gyp dependencies.

src/grpc.ts Outdated
const errorMessage =
'To use @grpc/grpc-js you must run your code on Node.js v8.13.0 or newer. Please see README if you need to use an older version. ' +
'https://github.com/googleapis/gax-nodejs/blob/master/README.md';
console.error(errorMessage);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Justin, throw is probably sufficient, as it will end up in stderr and output essentially the same message (but with stack trace).

@@ -15,13 +15,7 @@
'use strict';

const assert = require('assert');

let grpc;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like this update eliminates a lot of cruft.

@alexander-fenster alexander-fenster added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 3, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 3, 2019
@alexander-fenster alexander-fenster added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 3, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 3, 2019
@alexander-fenster alexander-fenster merged commit b872f2b into master May 4, 2019
@alexander-fenster alexander-fenster deleted the no-grpc branch May 4, 2019 02:29
@release-please release-please bot mentioned this pull request Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants