-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to rc4 of conformance suite and fix several issues (#248)
There are a handful of changes in here that go along with this update of the conformance tests. 1. This updates the HTTP code -> RPC code mappings per latest updates to the spec [here](connectrpc/connectrpc.com#130). 2. The newest release candidate of conformance tests really wants clients to report "exception metadata" as trailers, and for that to be a combined view of headers _and_ trailers for unary and client-stream errors. The reasoning is related to the fact that, in the gRPC and gRPC-Web protocols, a server can choose to combine headers and trailers into a "trailers-only" response when there are no response messages (which is always the case for unary and client-stream error responses). So the caller only checking headers or trailers when querying a particular key is brittle; and the caller checking _both_ headers and trailers is annoying and verbose. Instead, the combined metadata is reported as part of the exception, and the caller then has one bucket of metadata to query for a particular key, which is less error-prone. 3. Unary and client-stream operations now properly handle cases where there is either zero or more than one response message combined with a non-error status. They return "unimplemented" as indicated by [this doc](https://grpc.github.io/grpc/core/md_doc_statuscodes.html) on RPC status codes (search therein for "cardinality violation"). 4. In the Connect protocol, we correctly default to the code inferred from the HTTP status code, instead of always falling back to "unknown" in the event that the code cannot be successfully parsed from the JSON error body. 5. The `ConnectException` now uses a private constructor to provide a strong invariant that the error detail parser is always non-nil if there are non-empty error details. Previously, the old constructor allowed a caller to provide non-empty details but a null error parser, in which case the `unpackedDetails` method would not behave correctly. It also had an awkward public `setErrorParser` method which was actually only called from one place where the call was not even needed (this method was not actually needed since it was previously declared as a `data` class, which means it gets an automatic `copy` method that could have been used to set the parser field). This is technically a backwards-incompatible change since the public constructor now has two fewer parameters. It is also no longer a `data` class (since the automatic `copy` method would have allowed the new invariant to be subverted -- a caller could invoke `ex.copy(errorDetailParser = null)`).
- Loading branch information
Showing
19 changed files
with
209 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,13 @@ | ||
# If error body is JSON null, it is interpreted as an unknown error | ||
# instead of falling back to basing code on the HTTP status. | ||
Connect Error and End-Stream/**/error/null | ||
|
||
# Deadline headers are not currently set. | ||
Deadline Propagation/** | ||
|
||
# This response doesn't look like a normal Connect response, so it | ||
# goes through okhttp's default 408 code handling, which retries. | ||
# The retry triggers an error: | ||
# client sent another request (#2) for the same test case | ||
HTTP to Connect Code Mapping/**/request-timeout | ||
|
||
# Bug: response content-type is not correctly checked | ||
Unexpected Responses/**/unexpected-content-type | ||
**/unexpected-content-type | ||
|
||
# Bug: "trailers-only" responses are not correctly identified. | ||
# If headers contain "grpc-status", this client assumes it is a | ||
# trailers-only response. However, a trailers-only response should | ||
# instead be identified by lack of body or HTTP trailers. | ||
gRPC Unexpected Responses/**/trailers-only/* | ||
gRPC-Web Unexpected Responses/**/trailers-only/ignore-header-if-body-present | ||
|
||
# Bug: if gRPC unary response contains zero messages or | ||
# more than one message, client does not complain if | ||
# status trailers says "ok" | ||
gRPC Unexpected Responses/**/unary-multiple-responses | ||
gRPC Unexpected Responses/**/unary-ok-but-no-response | ||
gRPC-Web Unexpected Responses/**/unary-ok-but-no-response | ||
|
||
# Bug: incorrect code attribution for these failures (INTERNAL instead of UNKNOWN) | ||
gRPC-Web Unexpected Responses/**/missing-status | ||
gRPC-Web Unexpected Responses/**/trailers-in-body/unary-multiple-responses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.