File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -3960,7 +3960,22 @@ func (s) TestServerStreaming_ClientCallSendMsgTwice(t *testing.T) {
39603960 // Block until the stream’s context is done. Second call to client.SendMsg
39613961 // triggers a RST_STREAM which cancels the stream context on the server.
39623962 <- stream .Context ().Done ()
3963- if err := stream .SendMsg (& testpb.StreamingOutputCallRequest {}); status .Code (err ) != codes .Canceled {
3963+ var err error
3964+ waitCtx , cancel := context .WithTimeout (context .Background (), defaultTestShortTimeout )
3965+ defer cancel ()
3966+ for {
3967+ err = stream .SendMsg (& testpb.StreamingOutputCallRequest {})
3968+ if err != nil {
3969+ break
3970+ }
3971+ select {
3972+ case <- waitCtx .Done ():
3973+ t .Fatalf ("timeout while waiting for stream.SendMsg() to return an error " )
3974+ default :
3975+ time .Sleep (10 * time .Millisecond )
3976+ }
3977+ }
3978+ if status .Code (err ) != codes .Canceled {
39643979 t .Errorf ("stream.SendMsg() = %v, want error %v" , err , codes .Canceled )
39653980 }
39663981 close (handlerDone )
You can’t perform that action at this time.
0 commit comments