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

chore: Add Showcase Callables IT #1483

Merged
merged 19 commits into from
Mar 23, 2023
Merged

chore: Add Showcase Callables IT #1483

merged 19 commits into from
Mar 23, 2023

Conversation

lqiu96
Copy link
Contributor

@lqiu96 lqiu96 commented Mar 13, 2023

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:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Part of #1439 ☕️

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Mar 13, 2023
@lqiu96 lqiu96 mentioned this pull request Mar 13, 2023
27 tasks
renovate-bot and others added 6 commits March 14, 2023 18:00
…e-plugin to v3.0.0 (#1488)

Co-authored-by: Lawrence Qiu <lawrenceqiu@google.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Lawrence Qiu <lawrenceqiu@google.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Mar 14, 2023
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: l Pull request size is large. labels Mar 14, 2023
@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: m Pull request size is medium. labels Mar 22, 2023
@lqiu96
Copy link
Contributor Author

lqiu96 commented Mar 22, 2023

Updating this PR following Mridula's PR: #1501

@lqiu96 lqiu96 marked this pull request as ready for review March 22, 2023 20:39
@lqiu96 lqiu96 requested a review from a team as a code owner March 22, 2023 20:39
*/
@Test
public void testHttpJson_serverResponseError_throwsException() {
StatusCode.Code notFoundStatusCode = StatusCode.Code.NOT_FOUND;
Copy link
Contributor

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.

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 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.

Copy link
Contributor

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.

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'll update to CANCELLED.

@Test
public void testHttpJson_serverResponseError_throwsException() {
StatusCode.Code notFoundStatusCode = StatusCode.Code.NOT_FOUND;
ApiException exception =
Copy link
Contributor

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.

Copy link
Contributor Author

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())
Copy link
Contributor

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?

Copy link
Contributor Author

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

Comment on lines 117 to 118
assertThat(exception.getStatusCode().getCode()).isEqualTo(cancelledStatusCode);
}
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. Updating.

@sonarcloud
Copy link

sonarcloud bot commented Mar 23, 2023

[gapic-generator-java-root] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sonarcloud
Copy link

sonarcloud bot commented Mar 23, 2023

[java_showcase_integration_tests] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@sonarcloud
Copy link

sonarcloud bot commented Mar 23, 2023

[java_showcase_unit_tests] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@mpeddada1 mpeddada1 left a 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.

@lqiu96 lqiu96 merged commit ff19831 into main Mar 23, 2023
@lqiu96 lqiu96 deleted the main-showcase_callables branch March 23, 2023 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants