Skip to content

Commit

Permalink
clientv3: pass "grpc.WithBlock" on "TestDialTimeout"
Browse files Browse the repository at this point in the history
Otherwise, grpc.DialContext would just return before
connection is up.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
  • Loading branch information
gyuho committed Jun 15, 2018
1 parent 037d7b4 commit 994a569
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clientv3/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (

"github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
"github.com/coreos/etcd/pkg/testutil"

"google.golang.org/grpc"
)

func TestDialCancel(t *testing.T) {
Expand Down Expand Up @@ -80,14 +82,17 @@ func TestDialCancel(t *testing.T) {
func TestDialTimeout(t *testing.T) {
defer testutil.AfterTest(t)

// grpc.WithBlock to block until connection up or timeout
testCfgs := []Config{
{
Endpoints: []string{"http://254.0.0.1:12345"},
DialTimeout: 2 * time.Second,
DialOptions: []grpc.DialOption{grpc.WithBlock()},
},
{
Endpoints: []string{"http://254.0.0.1:12345"},
DialTimeout: time.Second,
DialOptions: []grpc.DialOption{grpc.WithBlock()},
Username: "abc",
Password: "def",
},
Expand Down

0 comments on commit 994a569

Please sign in to comment.