MCPcopy
hub / github.com/grpc/grpc-go / doServerStreamCall

Method doServerStreamCall

binarylog/binarylog_end2end_test.go:398–429  ·  view source on GitHub ↗
(c *rpcConfig)

Source from the content-addressed store, hash-verified

396}
397
398func (te *test) doServerStreamCall(c *rpcConfig) (proto.Message, []proto.Message, error) {
399 var (
400 req *testpb.StreamingOutputCallRequest
401 resps []proto.Message
402 err error
403 )
404
405 tc := testgrpc.NewTestServiceClient(te.ss.CC)
406 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
407 defer cancel()
408 ctx = metadata.NewOutgoingContext(ctx, testMetadata)
409
410 var startID int32
411 if !c.success {
412 startID = errorID
413 }
414 req = &testpb.StreamingOutputCallRequest{Payload: idToPayload(startID)}
415 stream, err := tc.StreamingOutputCall(ctx, req)
416 if err != nil {
417 return req, resps, err
418 }
419 for {
420 var resp *testpb.StreamingOutputCallResponse
421 resp, err := stream.Recv()
422 if err == io.EOF {
423 return req, resps, nil
424 } else if err != nil {
425 return req, resps, err
426 }
427 resps = append(resps, resp)
428 }
429}
430
431type expectedData struct {
432 te *test

Callers 1

runRPCsFunction · 0.45

Calls 4

StreamingOutputCallMethod · 0.95
NewOutgoingContextFunction · 0.92
idToPayloadFunction · 0.70
RecvMethod · 0.65

Tested by

no test coverage detected