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

Function testLargeUnary

test/end2end_test.go:2264–2295  ·  view source on GitHub ↗
(t *testing.T, e env)

Source from the content-addressed store, hash-verified

2262}
2263
2264func testLargeUnary(t *testing.T, e env) {
2265 te := newTest(t, e)
2266 te.startServer(&testServer{security: e.security})
2267 defer te.tearDown()
2268 tc := testgrpc.NewTestServiceClient(te.clientConn())
2269
2270 const argSize = 271828
2271 const respSize = 314159
2272
2273 payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, argSize)
2274 if err != nil {
2275 t.Fatal(err)
2276 }
2277
2278 req := &testpb.SimpleRequest{
2279 ResponseType: testpb.PayloadType_COMPRESSABLE,
2280 ResponseSize: respSize,
2281 Payload: payload,
2282 }
2283
2284 ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
2285 defer cancel()
2286 reply, err := tc.UnaryCall(ctx, req)
2287 if err != nil {
2288 t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, <nil>", err)
2289 }
2290 pt := reply.GetPayload().GetType()
2291 ps := len(reply.GetPayload().GetBody())
2292 if pt != testpb.PayloadType_COMPRESSABLE || ps != respSize {
2293 t.Fatalf("Got the reply with type %d len %d; want %d, %d", pt, ps, testpb.PayloadType_COMPRESSABLE, respSize)
2294 }
2295}
2296
2297// Test backward-compatibility API for setting msg size limit.
2298func (s) TestExceedMsgLimit(t *testing.T) {

Callers 1

TestLargeUnaryMethod · 0.85

Calls 11

UnaryCallMethod · 0.95
newPayloadFunction · 0.85
newTestFunction · 0.70
FatalMethod · 0.65
FatalfMethod · 0.65
startServerMethod · 0.45
tearDownMethod · 0.45
clientConnMethod · 0.45
GetTypeMethod · 0.45
GetPayloadMethod · 0.45
GetBodyMethod · 0.45

Tested by

no test coverage detected