mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	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 <leegyuho@amazon.com>
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user