-
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 Showcase Callables IT #1483
Conversation
…e-plugin to v3.0.0 (#1488) Co-authored-by: Lawrence Qiu <[email protected]>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Lawrence Qiu <[email protected]>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Updating this PR following Mridula's PR: #1501 |
*/ | ||
@Test | ||
public void testHttpJson_serverResponseError_throwsException() { | ||
StatusCode.Code notFoundStatusCode = StatusCode.Code.NOT_FOUND; |
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.
You may have already covered this in the javadoc but is there an advantage of using NOT_FOUND
over CANCELLED
? Mostly wondering if the grpc tests should also be switched to use 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.
I just picked NOT_FOUND instead of CANCELLED since the docs seem to suggest that CANCELLED status is from a user action (https://chromium.googlesource.com/external/github.com/grpc/grpc/+/refs/tags/v1.21.4-pre1/doc/statuscodes.md). Any error code should be fine since we just need the server to respond back with the error.
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.
Whether we choose NOT_FOUND
or CANCELLED
, let's please make this and testGrpc_serverResponseError_throwsException
consistent so we aren't implying a difference in behavior. If we want to test both behaviors, let's do so explicitly.
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'll update to CANCELLED.
@Test | ||
public void testHttpJson_serverResponseError_throwsException() { | ||
StatusCode.Code notFoundStatusCode = StatusCode.Code.NOT_FOUND; | ||
ApiException exception = |
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.
Perhaps we can make the exception more specific here? To make sure that the test doesn't pass for a false positive case since ApiException can occur for a number of reasons.
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.
Yeah changed.
() -> | ||
httpJsonClient.echo( | ||
EchoRequest.newBuilder() | ||
.setError(Status.newBuilder().setCode(notFoundStatusCode.ordinal()).build()) |
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.
nit: this may not work but can the inner build()
call be omitted when we nest builders? i.e. does EchoRequest.newBuilder().setError(Status.newBuilder().setCode(notFoundStatusCode.ordinal())).build()
work?
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.
Moved it out to a variable
assertThat(exception.getStatusCode().getCode()).isEqualTo(cancelledStatusCode); | ||
} |
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.
nit: How about we use HttpJsonStatusCode.Code.CANCELLED
here?
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.
Sounds good. Updating.
[gapic-generator-java-root] Kudos, SonarCloud Quality Gate passed! |
[java_showcase_integration_tests] Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
[java_showcase_unit_tests] Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
LGTM! Will let @burkedavison provide the final approval.
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:
Part of #1439 ☕️