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.
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.
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.
What's the plan with the Http tests? Duplicates of the above coming soon?
There was a problem hiding this comment.
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.
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.
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.
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> ☕️