Skip to content

Commit

Permalink
clientv3/integration: match context canceled on client close
Browse files Browse the repository at this point in the history
Fix etcd-io#8329.

Different behavior from grpc/grpc-go#1369,
in grpc-go transportMonitor.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
  • Loading branch information
gyuho authored and visheshnp committed Aug 3, 2017
1 parent b73d7da commit ffc1997
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions clientv3/integration/lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,12 @@ func TestLeaseGrantErrConnClosed(t *testing.T) {
go func() {
defer close(donec)
_, err := cli.Grant(context.TODO(), 5)
if err != nil && err != grpc.ErrClientConnClosing {
t.Fatalf("expected %v, got %v", grpc.ErrClientConnClosing, err)
if err != nil && err != grpc.ErrClientConnClosing && err != context.Canceled {
// grpc.ErrClientConnClosing if grpc-go balancer calls 'Get' after client.Close.
// context.Canceled if grpc-go balancer calls 'Get' with inflight client.Close,
// soon transportMonitor selects on ClientTransport.Error() and resetTransport(false)
// that cancels the context and closes the transport.
t.Fatalf("expected %v or %v, got %v", grpc.ErrClientConnClosing, context.Canceled, err)
}
}()

Expand Down

0 comments on commit ffc1997

Please sign in to comment.