mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #8349 from gyuho/fix-lease-test
clientv3/integration: match context canceled on client close
This commit is contained in:
commit
45e6b658dd
@ -286,8 +286,12 @@ func TestLeaseGrantErrConnClosed(t *testing.T) {
|
|||||||
go func() {
|
go func() {
|
||||||
defer close(donec)
|
defer close(donec)
|
||||||
_, err := cli.Grant(context.TODO(), 5)
|
_, err := cli.Grant(context.TODO(), 5)
|
||||||
if err != nil && err != grpc.ErrClientConnClosing {
|
if err != nil && err != grpc.ErrClientConnClosing && err != context.Canceled {
|
||||||
t.Fatalf("expected %v, got %v", grpc.ErrClientConnClosing, err)
|
// 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)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user