Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
arjan-bal committed Dec 18, 2024
1 parent 9ef12af commit a4e0005
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions test/compressor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ func (s) TestDecompressionExceedsMaxMessageSize(t *testing.T) {
defer func() {
encoding.RegisterCompressor(oldC)
}()
messageLen := 100
const messageLen = 100
encoding.RegisterCompressor(&fakeCompressor{decompressedMessageSize: messageLen})
ss := &stubserver.StubServer{
UnaryCallF: func(context.Context, *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
Expand All @@ -838,17 +838,9 @@ func (s) TestDecompressionExceedsMaxMessageSize(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()

p, err := newPayload(testpb.PayloadType_COMPRESSABLE, int32(50))
if err != nil {
t.Fatalf("Unexpected error from newPayload: %v", err)
}
req := &testpb.SimpleRequest{Payload: p}
_, err = ss.Client.UnaryCall(ctx, req, grpc.UseCompressor("gzip"))
if err == nil {
t.Errorf("Client.UnaryCall(%+v) = nil, want %v", req, codes.ResourceExhausted)
}

req := &testpb.SimpleRequest{Payload: &testpb.Payload{}}
_, err := ss.Client.UnaryCall(ctx, req, grpc.UseCompressor("gzip"))
if got, want := status.Code(err), codes.ResourceExhausted; got != want {
t.Errorf("Client.UnaryCall(%+v) returned stats %v, want %v", req, got, want)
t.Errorf("Client.UnaryCall(%+v) returned status %v, want %v", req, got, want)
}
}

0 comments on commit a4e0005

Please sign in to comment.