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

Add tests for connect error detail debug data #921

Merged
merged 6 commits into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,73 @@ testCases:
error:
code: CODE_OUT_OF_RANGE
message: oops
- request:
# Clients must not depend on data in the "debug" key when deserializing details.
testName: error/invalid-details-debug
service: connectrpc.conformance.v1.ConformanceService
method: Unary
streamType: STREAM_TYPE_UNARY
requestMessages:
- "@type": type.googleapis.com/connectrpc.conformance.v1.UnaryRequest
responseDefinition:
rawResponse:
statusCode: 422
headers:
- name: content-type
value: [ "application/json" ]
unary:
text: |
{
"code": "out_of_range",
"message": "oops",
"details": [
{
"type": "google.protobuf.FileDescriptorProto",
"value": "Cgp0ZXN0LnByb3Rv",
"debug": "garbage"
}
]
}
expectedResponse:
error:
code: CODE_OUT_OF_RANGE
message: oops
details:
- "@type": type.googleapis.com/google.protobuf.FileDescriptorProto
name: "test.proto"
- request:
# Clients must not depend on data in the "debug" key when deserializing details.
testName: error/missing-details-debug
service: connectrpc.conformance.v1.ConformanceService
method: Unary
streamType: STREAM_TYPE_UNARY
requestMessages:
- "@type": type.googleapis.com/connectrpc.conformance.v1.UnaryRequest
responseDefinition:
rawResponse:
statusCode: 422
headers:
- name: content-type
value: [ "application/json" ]
unary:
text: |
{
"code": "out_of_range",
"message": "oops",
"details": [
{
"type": "google.protobuf.FileDescriptorProto",
"value": "Cgp0ZXN0LnByb3Rv"
}
]
}
expectedResponse:
error:
code: CODE_OUT_OF_RANGE
message: oops
details:
- "@type": type.googleapis.com/google.protobuf.FileDescriptorProto
name: "test.proto"
# # TODO: We can't actually represent an unrecognized detail in the YAML format, because
# # we use google.protobuf.Any, which requires the schema to represent in JSON or YAML 😭
# - request:
Expand Down Expand Up @@ -358,3 +425,80 @@ testCases:
details:
- "@type": type.googleapis.com/google.protobuf.FileDescriptorProto
name: "test.proto"
- request:
# Clients must not depend on data in the "debug" key when deserializing details.
testName: end-stream/invalid-details-debug
service: connectrpc.conformance.v1.ConformanceService
method: ServerStream
streamType: STREAM_TYPE_SERVER_STREAM
requestMessages:
- "@type": type.googleapis.com/connectrpc.conformance.v1.ServerStreamRequest
responseDefinition:
rawResponse:
statusCode: 200
headers:
- name: content-type
value: [ "application/connect+proto" ]
stream:
items:
- flags: 2
payload:
text: |
{
"error": {
"code": "out_of_range",
"message": "oops",
"details": [
{
"type": "google.protobuf.FileDescriptorProto",
"value": "Cgp0ZXN0LnByb3Rv",
"debug": "garbage"
}
]
}
}
expectedResponse:
error:
code: CODE_OUT_OF_RANGE
message: oops
details:
- "@type": type.googleapis.com/google.protobuf.FileDescriptorProto
name: "test.proto"
- request:
# Clients must not depend on data in the "debug" key when deserializing details.
testName: end-stream/missing-details-debug
service: connectrpc.conformance.v1.ConformanceService
method: ServerStream
streamType: STREAM_TYPE_SERVER_STREAM
requestMessages:
- "@type": type.googleapis.com/connectrpc.conformance.v1.ServerStreamRequest
responseDefinition:
rawResponse:
statusCode: 200
headers:
- name: content-type
value: [ "application/connect+proto" ]
stream:
items:
- flags: 2
payload:
text: |
{
"error": {
"code": "out_of_range",
"message": "oops",
"details": [
{
"type": "google.protobuf.FileDescriptorProto",
"value": "Cgp0ZXN0LnByb3Rv"
}
]
}
}
expectedResponse:
error:
code: CODE_OUT_OF_RANGE
message: oops
details:
- "@type": type.googleapis.com/google.protobuf.FileDescriptorProto
name: "test.proto"
Loading