-
Notifications
You must be signed in to change notification settings - Fork 53
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
chore: add unary-unary showcase test for gRPC support #1501
Conversation
I have a similar PR: #1483 for callables. I can move the httpjson unary tests to ITUnaryCallable after this goes in |
public void testGrpc_serverResponseError_throwsException() { | ||
Status cancelledStatus = Status.newBuilder().setCode(StatusCode.Code.CANCELLED.ordinal()).build(); | ||
EchoRequest requestWithServerError = EchoRequest.newBuilder().setError(cancelledStatus).build(); | ||
CancelledException exception = assertThrows(CancelledException.class, () -> grpcClient.echo(requestWithServerError)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have code formatting set up for this project? Mix of 2+4 space indents plus some rather large lines makes me think something is awry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out! Sorry, I missed importing the formatter after switching IDEs.
showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java
Show resolved
Hide resolved
|
||
@Test | ||
public void testHttpJson() { | ||
assertThat(echoHttpJson("http-echo?")).isEqualTo("http-echo?"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the plan with the Http tests? Duplicates of the above coming soon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add in httpjson versions of the gRPC calls in a separate PR
@Test | ||
public void testGrpc_shutdown() { | ||
assertThat(grpcClient.isShutdown()).isFalse(); | ||
grpcClient.shutdown(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QQ, would this make the test dependent on the ordering? i.e. if testGrpc_shutdown
gets called first and then the client is shutdown, would the other tests still run properly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! I think you're right, this would make the tests interdependent. Let me look into modifying this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, looks like avoiding the static states as @burkedavison suggested in the previous comment is the way to go if we are to have self-contained tests.
[gapic-generator-java-root] Kudos, SonarCloud Quality Gate passed! |
Thank you for opening a Pull Request! For general contributing guidelines, please refer to contributing guide
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> ☕️