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

Function DoClientStreaming

interop/test_utils.go:109–132  ·  view source on GitHub ↗

DoClientStreaming performs a client streaming RPC.

(ctx context.Context, tc testgrpc.TestServiceClient, args ...grpc.CallOption)

Source from the content-addressed store, hash-verified

107
108// DoClientStreaming performs a client streaming RPC.
109func DoClientStreaming(ctx context.Context, tc testgrpc.TestServiceClient, args ...grpc.CallOption) {
110 stream, err := tc.StreamingInputCall(ctx, args...)
111 if err != nil {
112 logger.Fatalf("%v.StreamingInputCall(_) = _, %v", tc, err)
113 }
114 var sum int
115 for _, s := range reqSizes {
116 pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, s)
117 req := &testpb.StreamingInputCallRequest{
118 Payload: pl,
119 }
120 if err := stream.Send(req); err != nil {
121 logger.Fatalf("%v has error %v while sending %v", stream, err, req)
122 }
123 sum += s
124 }
125 reply, err := stream.CloseAndRecv()
126 if err != nil {
127 logger.Fatalf("%v.CloseAndRecv() got error %v, want %v", stream, err, nil)
128 }
129 if reply.GetAggregatedPayloadSize() != int32(sum) {
130 logger.Fatalf("%v.CloseAndRecv().GetAggregatePayloadSize() = %v; want %v", stream, reply.GetAggregatedPayloadSize(), sum)
131 }
132}
133
134// DoServerStreaming performs a server streaming RPC.
135func DoServerStreaming(ctx context.Context, tc testgrpc.TestServiceClient, args ...grpc.CallOption) {

Callers 2

mainFunction · 0.92
performRPCsFunction · 0.92

Calls 6

ClientNewPayloadFunction · 0.85
StreamingInputCallMethod · 0.65
FatalfMethod · 0.65
SendMethod · 0.65
CloseAndRecvMethod · 0.65

Tested by

no test coverage detected