(msgsPerStreamCall int)
| 65 | } |
| 66 | |
| 67 | func callToStreaming(msgsPerStreamCall int) func(ctx context.Context, c FakeServerClient) error { |
| 68 | return func(ctx context.Context, c FakeServerClient) error { |
| 69 | rcvd := 0 |
| 70 | s, err := c.StreamSleep(ctx, &emptypb.Empty{}) |
| 71 | if err != nil { |
| 72 | return err |
| 73 | } |
| 74 | |
| 75 | for { |
| 76 | _, err := s.Recv() |
| 77 | if err != nil { |
| 78 | if errors.Is(err, io.EOF) { |
| 79 | break |
| 80 | } |
| 81 | return err |
| 82 | } |
| 83 | rcvd++ |
| 84 | } |
| 85 | |
| 86 | if rcvd != msgsPerStreamCall { |
| 87 | return fmt.Errorf("invalid number of received messages: %d", rcvd) |
| 88 | } |
| 89 | return nil |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | func TestGrpcLimitCheckUnary(t *testing.T) { |
| 94 | const msgsPerStreamCall = 5 |
no test coverage detected