Tests that a client receives a cardinality violation error for client-streaming RPCs if the server calls SendMsg() multiple times.
(t *testing.T)
| 4198 | // Tests that a client receives a cardinality violation error for client-streaming |
| 4199 | // RPCs if the server calls SendMsg() multiple times. |
| 4200 | func (s) TestClientStreaming_ServerHandlerSendMsgAfterSendMsg(t *testing.T) { |
| 4201 | ss := stubserver.StubServer{ |
| 4202 | StreamingInputCallF: func(stream testgrpc.TestService_StreamingInputCallServer) error { |
| 4203 | if err := stream.SendMsg(&testpb.StreamingInputCallResponse{}); err != nil { |
| 4204 | t.Errorf("stream.SendMsg(_) = %v, want <nil>", err) |
| 4205 | } |
| 4206 | if err := stream.SendMsg(&testpb.StreamingInputCallResponse{}); err != nil { |
| 4207 | t.Errorf("stream.SendMsg(_) = %v, want <nil>", err) |
| 4208 | } |
| 4209 | return nil |
| 4210 | }, |
| 4211 | } |
| 4212 | if err := ss.Start(nil); err != nil { |
| 4213 | t.Fatal("Error starting server:", err) |
| 4214 | } |
| 4215 | defer ss.Stop() |
| 4216 | |
| 4217 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 4218 | defer cancel() |
| 4219 | stream, err := ss.Client.StreamingInputCall(ctx) |
| 4220 | if err != nil { |
| 4221 | t.Fatalf(".StreamingInputCall(_) = _, %v, want <nil>", err) |
| 4222 | } |
| 4223 | if err := stream.Send(&testpb.StreamingInputCallRequest{}); err != nil { |
| 4224 | t.Fatalf("stream.Send(_) = %v, want <nil>", err) |
| 4225 | } |
| 4226 | if _, err := stream.CloseAndRecv(); status.Code(err) != codes.Internal { |
| 4227 | t.Fatalf("stream.CloseAndRecv() = %v, want error with status code %s", err, codes.Internal) |
| 4228 | } |
| 4229 | } |
| 4230 | |
| 4231 | func (s) TestExceedMaxStreamsLimit(t *testing.T) { |
| 4232 | for _, e := range listTestEnv() { |
nothing calls this directly
no test coverage detected