Skip to content

Commit

Permalink
[FAB-13411] fix flake in TestServerInterceptors
Browse files Browse the repository at this point in the history
The server stream interceptor added by TestServerInterceptors returns an
error that causes the server side of the stream to terminate. That means
the client side send may get an io.EOF from Send if the termination of
the server side of the stream was detected.

Change-Id: I237f0aad6daa2878a987509e35074a16b689feba
Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
(cherry picked from commit 6e56e6e)
  • Loading branch information
sykesm authored and denyeart committed Jan 4, 2019
1 parent 7bb9b7e commit a83e1ca
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/comm/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,18 @@ func invokeEmptyStream(address string, dialOptions []grpc.DialOption) (*testpb.E
}
}()

if err := stream.Send(new(testpb.Empty)); err != nil {
return nil, err
// TestServerInterceptors adds an interceptor that does not call the target
// StreamHandler and returns an error so Send can return with an io.EOF since
// the server side has already terminated. Whether or not we get an error
// depends on timing.
err = stream.Send(&testpb.Empty{})
if err != nil && err != io.EOF {
return nil, fmt.Errorf("stream send failed: %s", err)
}

stream.CloseSend()
<-waitc
return msg, streamErr

}

const (
Expand Down

0 comments on commit a83e1ca

Please sign in to comment.