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

Method doClientStreamCall

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

Source from the content-addressed store, hash-verified

364}
365
366func (te *test) doClientStreamCall(c *rpcConfig) ([]proto.Message, proto.Message, error) {
367 var (
368 reqs []proto.Message
369 resp *testpb.StreamingInputCallResponse
370 err error
371 )
372 tc := testgrpc.NewTestServiceClient(te.ss.CC)
373 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
374 defer cancel()
375 ctx = metadata.NewOutgoingContext(ctx, testMetadata)
376
377 stream, err := tc.StreamingInputCall(ctx)
378 if err != nil {
379 return reqs, resp, err
380 }
381 var startID int32
382 if !c.success {
383 startID = errorID
384 }
385 for i := 0; i < c.count; i++ {
386 req := &testpb.StreamingInputCallRequest{
387 Payload: idToPayload(int32(i) + startID),
388 }
389 reqs = append(reqs, req)
390 if err = stream.Send(req); err != nil {
391 return reqs, resp, err
392 }
393 }
394 resp, err = stream.CloseAndRecv()
395 return reqs, resp, err
396}
397
398func (te *test) doServerStreamCall(c *rpcConfig) (proto.Message, []proto.Message, error) {
399 var (

Callers 1

runRPCsFunction · 0.45

Calls 5

StreamingInputCallMethod · 0.95
NewOutgoingContextFunction · 0.92
idToPayloadFunction · 0.70
SendMethod · 0.65
CloseAndRecvMethod · 0.65

Tested by

no test coverage detected