Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clientv3: fix balancer/retry #8710

Closed
wants to merge 17 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions clientv3/integration/leasing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"math/rand"
"reflect"
"strings"
"sync"
"testing"
"time"
Expand All @@ -28,6 +29,8 @@ import (
"github.com/coreos/etcd/clientv3/leasing"
"github.com/coreos/etcd/integration"
"github.com/coreos/etcd/pkg/testutil"

"google.golang.org/grpc/transport"
)

func TestLeasingPutGet(t *testing.T) {
Expand Down Expand Up @@ -1083,8 +1086,8 @@ func TestLeasingOwnerPutError(t *testing.T) {
clus.Members[0].Stop(t)
ctx, cancel := context.WithTimeout(context.TODO(), 100*time.Millisecond)
defer cancel()
if resp, err := lkv.Put(ctx, "k", "v"); err == nil {
t.Fatalf("expected error, got response %+v", resp)
if resp, err := lkv.Put(ctx, "k", "v"); err != context.DeadlineExceeded && !strings.Contains(err.Error(), "transport is closing") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rpc call should only return context type or status type error.

t.Fatalf("expected %v or %v, got %v, response %+v", context.DeadlineExceeded, transport.ErrConnClosing, err, resp)
}
}

Expand All @@ -1104,8 +1107,8 @@ func TestLeasingOwnerDeleteError(t *testing.T) {
clus.Members[0].Stop(t)
ctx, cancel := context.WithTimeout(context.TODO(), 100*time.Millisecond)
defer cancel()
if resp, err := lkv.Delete(ctx, "k"); err == nil {
t.Fatalf("expected error, got response %+v", resp)
if resp, err := lkv.Delete(ctx, "k"); err != context.DeadlineExceeded && !strings.Contains(err.Error(), "transport is closing") {
t.Fatalf("expected %v or %v, got %v, response %+v", context.DeadlineExceeded, transport.ErrConnClosing, err, resp)
}
}

Expand All @@ -1121,8 +1124,8 @@ func TestLeasingNonOwnerPutError(t *testing.T) {
clus.Members[0].Stop(t)
ctx, cancel := context.WithTimeout(context.TODO(), 100*time.Millisecond)
defer cancel()
if resp, err := lkv.Put(ctx, "k", "v"); err == nil {
t.Fatalf("expected error, got response %+v", resp)
if resp, err := lkv.Put(ctx, "k", "v"); err != context.DeadlineExceeded && !strings.Contains(err.Error(), "transport is closing") {
t.Fatalf("expected %v or %v, got %v, response %+v", context.DeadlineExceeded, transport.ErrConnClosing, err, resp)
}
}

Expand Down