Skip to content

Commit

Permalink
clientv3/integration: give more time for balancer resolution
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
  • Loading branch information
gyuho committed Jul 23, 2019
1 parent 166f2c2 commit 874f1bf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions clientv3/integration/black_hole_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ func TestBalancerUnderBlackholeKeepAliveWatch(t *testing.T) {

clus := integration.NewClusterV3(t, &integration.ClusterConfig{
Size: 2,
GRPCKeepAliveMinTime: 1 * time.Millisecond, // avoid too_many_pings
GRPCKeepAliveMinTime: time.Millisecond, // avoid too_many_pings
})
defer clus.Terminate(t)

eps := []string{clus.Members[0].GRPCAddr(), clus.Members[1].GRPCAddr()}

ccfg := clientv3.Config{
Endpoints: []string{eps[0]},
DialTimeout: 1 * time.Second,
DialTimeout: time.Second,
DialOptions: []grpc.DialOption{grpc.WithBlock()},
DialKeepAliveTime: 1 * time.Second,
DialKeepAliveTime: time.Second,
DialKeepAliveTimeout: 500 * time.Millisecond,
}

Expand All @@ -72,6 +72,9 @@ func TestBalancerUnderBlackholeKeepAliveWatch(t *testing.T) {
// endpoint can switch to eps[1] when it detects the failure of eps[0]
cli.SetEndpoints(eps...)

// give enough time for balancer resolution
time.Sleep(5 * time.Second)

clus.Members[0].Blackhole()

if _, err = clus.Client(1).Put(context.TODO(), "foo", "bar"); err != nil {
Expand Down

0 comments on commit 874f1bf

Please sign in to comment.