From b61433ef0f5e9ba20cb2e385859f59c7fe93b7d5 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Wed, 14 Aug 2019 17:28:35 -0700 Subject: [PATCH] test/integration: block etcd client creation until connection is up The new etcd balancer (>3.3.14, 3.4.0) uses an asynchronous resolver for endpoints. Without "WithBlock", the client may return before the connection is up. Signed-off-by: Gyuho Lee --- test/integration/utils.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/integration/utils.go b/test/integration/utils.go index 14a54ab9e46..276333d5b7a 100644 --- a/test/integration/utils.go +++ b/test/integration/utils.go @@ -20,6 +20,7 @@ import ( "testing" "time" + "google.golang.org/grpc" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" @@ -82,8 +83,12 @@ func GetEtcdClients(config storagebackend.TransportConfig) (*clientv3.Client, cl } cfg := clientv3.Config{ - Endpoints: config.ServerList, - TLS: tlsConfig, + Endpoints: config.ServerList, + DialTimeout: 20 * time.Second, + DialOptions: []grpc.DialOption{ + grpc.WithBlock(), // block until the underlying connection is up + }, + TLS: tlsConfig, } c, err := clientv3.New(cfg)