From 757b796dc0b3b1f3d42dbc719ce237af36b9ed1c Mon Sep 17 00:00:00 2001 From: Leonidas Vrachnis Date: Wed, 29 May 2024 12:08:22 +0200 Subject: [PATCH] chore: fix etcd deprecated warning (#491) --- go.mod | 17 ++++++++++------- go.sum | 3 --- testhelper/docker/resource/etcd/etcd.go | 20 ++++++++++++-------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index eabd70ff..8514e29f 100644 --- a/go.mod +++ b/go.mod @@ -52,20 +52,27 @@ require ( golang.org/x/oauth2 v0.20.0 golang.org/x/sync v0.7.0 golang.org/x/text v0.15.0 - google.golang.org/api v0.181.0 - google.golang.org/grpc v1.63.2 + google.golang.org/api v0.182.0 google.golang.org/protobuf v1.34.1 gopkg.in/alexcesaro/statsd.v2 v2.0.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 ) +require ( + cloud.google.com/go/pubsub v1.37.0 // indirect + github.com/google/renameio/v2 v2.0.0 // indirect + github.com/gorilla/handlers v1.5.2 // indirect + github.com/gorilla/mux v1.8.1 // indirect + github.com/pkg/xattr v0.4.9 // indirect + google.golang.org/grpc v1.64.0 // indirect +) + require ( cloud.google.com/go v0.114.0 // indirect cloud.google.com/go/auth v0.4.2 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect cloud.google.com/go/compute/metadata v0.3.0 // indirect cloud.google.com/go/iam v1.1.8 // indirect - cloud.google.com/go/pubsub v1.37.0 // indirect github.com/Azure/azure-pipeline-go v0.2.3 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Microsoft/go-winio v0.6.0 // indirect @@ -93,13 +100,10 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/renameio/v2 v2.0.0 // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.4 // indirect - github.com/gorilla/handlers v1.5.2 // indirect - github.com/gorilla/mux v1.8.1 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect @@ -125,7 +129,6 @@ require ( github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pierrec/lz4/v4 v4.1.17 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pkg/xattr v0.4.9 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/prometheus/procfs v0.12.0 // indirect diff --git a/go.sum b/go.sum index 265d6ca8..cdc98951 100644 --- a/go.sum +++ b/go.sum @@ -573,7 +573,6 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= -google.golang.org/api v0.181.0/go.mod h1:MnQ+M0CFsfUwA5beZ+g/vCBCPXvtmZwRz2qzZk8ih1k= google.golang.org/api v0.182.0 h1:if5fPvudRQ78GeRx3RayIoiuV7modtErPIZC/T2bIvE= google.golang.org/api v0.182.0/go.mod h1:cGhjy4caqA5yXRzEhkHI8Y9mfyC2VLTlER2l08xaqtM= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -592,8 +591,6 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/testhelper/docker/resource/etcd/etcd.go b/testhelper/docker/resource/etcd/etcd.go index 9f3c886a..31735205 100644 --- a/testhelper/docker/resource/etcd/etcd.go +++ b/testhelper/docker/resource/etcd/etcd.go @@ -1,6 +1,7 @@ package etcd import ( + "context" "fmt" "strconv" "time" @@ -8,7 +9,6 @@ import ( "github.com/ory/dockertest/v3" "github.com/ory/dockertest/v3/docker" etcd "go.etcd.io/etcd/client/v3" - "google.golang.org/grpc" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource" ) @@ -73,14 +73,18 @@ func Setup(pool *dockertest.Pool, cln resource.Cleaner, opts ...Option) (*Resour } etcdHosts = []string{"http://localhost:" + etcdPortStr} + + etcdClient, err = etcd.New(etcd.Config{ + Endpoints: etcdHosts, + DialTimeout: time.Second, + }) + if err != nil { + return nil, fmt.Errorf("setting up etcd client: %w", err) + } + err = pool.Retry(func() (err error) { - etcdClient, err = etcd.New(etcd.Config{ - Endpoints: etcdHosts, - DialOptions: []grpc.DialOption{ - grpc.WithBlock(), // block until the underlying connection is up - }, - DialTimeout: 10 * time.Second, - }) + _, err = etcdClient.Cluster.MemberList(context.Background()) + return err }) if err != nil {