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

Method doClientStreamCall

stats/stats_test.go:363–391  ·  view source on GitHub ↗
(c *rpcConfig)

Source from the content-addressed store, hash-verified

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

Callers 2

testServerStatsFunction · 0.45
testClientStatsFunction · 0.45

Calls 7

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

Tested by

no test coverage detected