TestNilStatsHandler ensures we do not panic as a result of a nil stats handler.
(t *testing.T)
| 6991 | // TestNilStatsHandler ensures we do not panic as a result of a nil stats |
| 6992 | // handler. |
| 6993 | func (s) TestNilStatsHandler(t *testing.T) { |
| 6994 | grpctest.ExpectErrorN("ignoring nil parameter", 2) |
| 6995 | ss := &stubserver.StubServer{ |
| 6996 | UnaryCallF: func(context.Context, *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { |
| 6997 | return &testpb.SimpleResponse{}, nil |
| 6998 | }, |
| 6999 | } |
| 7000 | if err := ss.Start([]grpc.ServerOption{grpc.StatsHandler(nil)}, grpc.WithStatsHandler(nil)); err != nil { |
| 7001 | t.Fatalf("Error starting endpoint server: %v", err) |
| 7002 | } |
| 7003 | defer ss.Stop() |
| 7004 | |
| 7005 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 7006 | defer cancel() |
| 7007 | if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{}); err != nil { |
| 7008 | t.Fatalf("Unexpected error from UnaryCall: %v", err) |
| 7009 | } |
| 7010 | } |
| 7011 | |
| 7012 | // TestUnexpectedEOF tests a scenario where a client invokes two unary RPC |
| 7013 | // calls. The first call receives a payload which exceeds max grpc receive |
nothing calls this directly
no test coverage detected