Skip to content

Commit

Permalink
clientv3/integration: KV APIs match grpc.ErrClientConnClosing
Browse files Browse the repository at this point in the history
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
  • Loading branch information
gyuho committed Sep 25, 2017
1 parent afcbe4a commit 09a43e5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions clientv3/integration/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ func TestKVGetErrConnClosed(t *testing.T) {
go func() {
defer close(donec)
_, err := cli.Get(context.TODO(), "foo")
if err != nil && err != grpc.ErrClientConnClosing {
if err != nil && err != context.DeadlineExceeded && err != grpc.ErrClientConnClosing {
t.Fatalf("expected %v, got %v", grpc.ErrClientConnClosing, err)
}
}()
Expand Down Expand Up @@ -791,8 +791,8 @@ func TestKVGetStoppedServerAndClose(t *testing.T) {
// this Get fails and triggers an asynchronous connection retry
_, err := cli.Get(ctx, "abc")
cancel()
if !strings.Contains(err.Error(), "context deadline") {
t.Fatal(err)
if err != nil && err != context.DeadlineExceeded && err != grpc.ErrClientConnClosing {
t.Fatalf("expected %v or %v, got %v", context.DeadlineExceeded, grpc.ErrClientConnClosing, err)
}
}

Expand All @@ -813,15 +813,15 @@ func TestKVPutStoppedServerAndClose(t *testing.T) {
// grpc finds out the original connection is down due to the member shutdown.
_, err := cli.Get(ctx, "abc")
cancel()
if !strings.Contains(err.Error(), "context deadline") {
t.Fatal(err)
if err != context.DeadlineExceeded && err != grpc.ErrClientConnClosing {
t.Fatalf("expected %v, got %v", grpc.ErrClientConnClosing, err)
}

// this Put fails and triggers an asynchronous connection retry
_, err = cli.Put(ctx, "abc", "123")
cancel()
if !strings.Contains(err.Error(), "context deadline") {
t.Fatal(err)
if err != nil && err != context.DeadlineExceeded && err != grpc.ErrClientConnClosing {
t.Fatalf("expected %v or %v, got %v", context.DeadlineExceeded, grpc.ErrClientConnClosing, err)
}
}

Expand Down

0 comments on commit 09a43e5

Please sign in to comment.