(t *testing.T)
| 413 | } |
| 414 | |
| 415 | func (s) TestUnarySetSendCompressorAfterHeaderSendFailure(t *testing.T) { |
| 416 | ss := &stubserver.StubServer{ |
| 417 | EmptyCallF: func(ctx context.Context, _ *testpb.Empty) (*testpb.Empty, error) { |
| 418 | // Send headers early and then set send compressor. |
| 419 | grpc.SendHeader(ctx, metadata.MD{}) |
| 420 | err := grpc.SetSendCompressor(ctx, "gzip") |
| 421 | if err == nil { |
| 422 | t.Error("Wanted set send compressor error") |
| 423 | return &testpb.Empty{}, nil |
| 424 | } |
| 425 | return nil, err |
| 426 | }, |
| 427 | } |
| 428 | if err := ss.Start(nil); err != nil { |
| 429 | t.Fatalf("Error starting endpoint server: %v", err) |
| 430 | } |
| 431 | defer ss.Stop() |
| 432 | |
| 433 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 434 | defer cancel() |
| 435 | |
| 436 | wantErr := status.Error(codes.Unknown, "transport: set send compressor called after headers sent or stream done") |
| 437 | if _, err := ss.Client.EmptyCall(ctx, &testpb.Empty{}); !equalError(err, wantErr) { |
| 438 | t.Fatalf("Unexpected unary call error, got: %v, want: %v", err, wantErr) |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | func (s) TestStreamSetSendCompressorAfterHeaderSendFailure(t *testing.T) { |
| 443 | ss := &stubserver.StubServer{ |
nothing calls this directly
no test coverage detected