(c *rpcConfig)
| 315 | } |
| 316 | |
| 317 | func (te *test) doFullDuplexCallRoundtrip(c *rpcConfig) ([]proto.Message, []proto.Message, error) { |
| 318 | var ( |
| 319 | reqs []proto.Message |
| 320 | resps []proto.Message |
| 321 | err error |
| 322 | ) |
| 323 | tc := testgrpc.NewTestServiceClient(te.ss.CC) |
| 324 | ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) |
| 325 | defer cancel() |
| 326 | ctx = metadata.NewOutgoingContext(ctx, testMetadata) |
| 327 | |
| 328 | stream, err := tc.FullDuplexCall(ctx) |
| 329 | if err != nil { |
| 330 | return reqs, resps, err |
| 331 | } |
| 332 | |
| 333 | if c.callType == cancelRPC { |
| 334 | cancel() |
| 335 | return reqs, resps, context.Canceled |
| 336 | } |
| 337 | |
| 338 | var startID int32 |
| 339 | if !c.success { |
| 340 | startID = errorID |
| 341 | } |
| 342 | for i := 0; i < c.count; i++ { |
| 343 | req := &testpb.StreamingOutputCallRequest{ |
| 344 | Payload: idToPayload(int32(i) + startID), |
| 345 | } |
| 346 | reqs = append(reqs, req) |
| 347 | if err = stream.Send(req); err != nil { |
| 348 | return reqs, resps, err |
| 349 | } |
| 350 | var resp *testpb.StreamingOutputCallResponse |
| 351 | if resp, err = stream.Recv(); err != nil { |
| 352 | return reqs, resps, err |
| 353 | } |
| 354 | resps = append(resps, resp) |
| 355 | } |
| 356 | if err = stream.CloseSend(); err != nil && err != io.EOF { |
| 357 | return reqs, resps, err |
| 358 | } |
| 359 | if _, err = stream.Recv(); err != io.EOF { |
| 360 | return reqs, resps, err |
| 361 | } |
| 362 | |
| 363 | return reqs, resps, nil |
| 364 | } |
| 365 | |
| 366 | func (te *test) doClientStreamCall(c *rpcConfig) ([]proto.Message, proto.Message, error) { |
| 367 | var ( |
no test coverage detected