(t *testing.T, e env)
| 3090 | } |
| 3091 | |
| 3092 | func testCancel(t *testing.T, e env) { |
| 3093 | te := newTest(t, e) |
| 3094 | te.declareLogNoise("grpc: the client connection is closing; please retry") |
| 3095 | te.startServer(&testServer{security: e.security, unaryCallSleepTime: time.Second}) |
| 3096 | defer te.tearDown() |
| 3097 | |
| 3098 | cc := te.clientConn() |
| 3099 | tc := testgrpc.NewTestServiceClient(cc) |
| 3100 | |
| 3101 | const argSize = 2718 |
| 3102 | const respSize = 314 |
| 3103 | |
| 3104 | payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, argSize) |
| 3105 | if err != nil { |
| 3106 | t.Fatal(err) |
| 3107 | } |
| 3108 | |
| 3109 | req := &testpb.SimpleRequest{ |
| 3110 | ResponseType: testpb.PayloadType_COMPRESSABLE, |
| 3111 | ResponseSize: respSize, |
| 3112 | Payload: payload, |
| 3113 | } |
| 3114 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 3115 | time.AfterFunc(1*time.Millisecond, cancel) |
| 3116 | if r, err := tc.UnaryCall(ctx, req); status.Code(err) != codes.Canceled { |
| 3117 | t.Fatalf("TestService/UnaryCall(_, _) = %v, %v; want _, error code: %s", r, err, codes.Canceled) |
| 3118 | } |
| 3119 | awaitNewConnLogOutput() |
| 3120 | } |
| 3121 | |
| 3122 | func (s) TestCancelNoIO(t *testing.T) { |
| 3123 | for _, e := range listTestEnv() { |
no test coverage detected