Skip to content

Commit 143eb37

Browse files
authored
Add new test cases to explicitly test error responses that also include metadata (#970)
1 parent 0180695 commit 143eb37

File tree

1 file changed

+63
-0
lines changed
  • internal/app/connectconformance/testsuites/data

1 file changed

+63
-0
lines changed

internal/app/connectconformance/testsuites/data/errors.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,21 @@ testCases:
149149
error:
150150
code: CODE_UNAUTHENTICATED
151151
message: "unauthenticated"
152+
- request:
153+
testName: unary/error-with-metadata
154+
streamType: STREAM_TYPE_UNARY
155+
requestMessages:
156+
- "@type": type.googleapis.com/connectrpc.conformance.v1.UnaryRequest
157+
responseDefinition:
158+
responseHeaders:
159+
- name: x-custom-header
160+
value: ["foo"]
161+
error:
162+
code: CODE_UNAUTHENTICATED
163+
message: "unauthenticated"
164+
responseTrailers:
165+
- name: x-custom-trailer
166+
value: ["bing"]
152167
- request:
153168
testName: unary/unicode-error-message
154169
streamType: STREAM_TYPE_UNARY
@@ -303,6 +318,21 @@ testCases:
303318
error:
304319
code: CODE_UNAUTHENTICATED
305320
message: "unauthenticated"
321+
- request:
322+
testName: server-stream/error-with-metadata
323+
streamType: STREAM_TYPE_SERVER_STREAM
324+
requestMessages:
325+
- "@type": type.googleapis.com/connectrpc.conformance.v1.ServerStreamRequest
326+
responseDefinition:
327+
responseHeaders:
328+
- name: x-custom-header
329+
value: ["foo"]
330+
error:
331+
code: CODE_UNAUTHENTICATED
332+
message: "unauthenticated"
333+
responseTrailers:
334+
- name: x-custom-trailer
335+
value: ["bing"]
306336
- request:
307337
testName: server-stream/error-with-responses
308338
streamType: STREAM_TYPE_SERVER_STREAM
@@ -352,6 +382,21 @@ testCases:
352382
error:
353383
code: CODE_INTERNAL
354384
message: "client stream failed"
385+
- request:
386+
testName: client-stream/error-with-metadata
387+
streamType: STREAM_TYPE_CLIENT_STREAM
388+
requestMessages:
389+
- "@type": type.googleapis.com/connectrpc.conformance.v1.ClientStreamRequest
390+
responseDefinition:
391+
responseHeaders:
392+
- name: x-custom-header
393+
value: ["foo"]
394+
error:
395+
code: CODE_UNAUTHENTICATED
396+
message: "unauthenticated"
397+
responseTrailers:
398+
- name: x-custom-trailer
399+
value: ["bing"]
355400
- request:
356401
testName: client-stream/error-multiple-requests
357402
streamType: STREAM_TYPE_CLIENT_STREAM
@@ -364,6 +409,24 @@ testCases:
364409
- "@type": type.googleapis.com/connectrpc.conformance.v1.ClientStreamRequest
365410
requestData: "dGVzdCByZXNwb25zZQ=="
366411
# Bidi Stream Tests -----------------------------------------------------------
412+
- request:
413+
testName: bidi-stream/error-with-metadata
414+
# Since there is only one request and there are no responses, this is
415+
# compatible with both half- and full-duplex implementations. We tag it
416+
# as half-duplex so it can potentially run under more configurations.
417+
streamType: STREAM_TYPE_HALF_DUPLEX_BIDI_STREAM
418+
requestMessages:
419+
- "@type": type.googleapis.com/connectrpc.conformance.v1.BidiStreamRequest
420+
responseDefinition:
421+
responseHeaders:
422+
- name: x-custom-header
423+
value: ["foo"]
424+
error:
425+
code: CODE_UNAUTHENTICATED
426+
message: "unauthenticated"
427+
responseTrailers:
428+
- name: x-custom-trailer
429+
value: ["bing"]
367430
- request:
368431
testName: bidi-stream/full-duplex/error-with-responses
369432
streamType: STREAM_TYPE_FULL_DUPLEX_BIDI_STREAM

0 commit comments

Comments
 (0)