Less mem (#1987)
* Export changes to OSS. * First commit. * Cherry-pick. * Documentation. * Post review updates.
This commit is contained in:
11
call_test.go
11
call_test.go
@ -66,17 +66,16 @@ type testStreamHandler struct {
|
||||
}
|
||||
|
||||
func (h *testStreamHandler) handleStream(t *testing.T, s *transport.Stream) {
|
||||
p := &parser{r: s}
|
||||
for {
|
||||
pf, req, err := p.recvMsg(math.MaxInt32)
|
||||
isCompressed, req, err := recvMsg(s, math.MaxInt32)
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if pf != compressionNone {
|
||||
t.Errorf("Received the mistaken message format %d, want %d", pf, compressionNone)
|
||||
if isCompressed {
|
||||
t.Errorf("Received compressed message want non-compressed message")
|
||||
return
|
||||
}
|
||||
var v string
|
||||
@ -105,12 +104,12 @@ func (h *testStreamHandler) handleStream(t *testing.T, s *transport.Stream) {
|
||||
}
|
||||
}
|
||||
// send a response back to end the stream.
|
||||
hdr, data, err := encode(testCodec{}, &expectedResponse, nil, nil, nil)
|
||||
data, err := encode(testCodec{}, &expectedResponse, nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to encode the response: %v", err)
|
||||
return
|
||||
}
|
||||
h.t.Write(s, hdr, data, &transport.Options{})
|
||||
h.t.Write(s, data, &transport.Options{})
|
||||
h.t.WriteStatus(s, status.New(codes.OK, ""))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user