Skip to content
Snippets Groups Projects
Commit 1acff763 authored by ale's avatar ale
Browse files

Wait for etcd GRPC connection to be established in radioctl

parent 6e539047
Branches
No related tags found
1 merge request!34Update etcd client to 3.5.0-alpha
Pipeline #15621 passed
...@@ -17,6 +17,7 @@ import ( ...@@ -17,6 +17,7 @@ import (
pb "git.autistici.org/ale/autoradio/proto" pb "git.autistici.org/ale/autoradio/proto"
"github.com/google/subcommands" "github.com/google/subcommands"
"go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3"
"google.golang.org/grpc"
) )
// Format for output of structured data. // Format for output of structured data.
...@@ -86,6 +87,7 @@ func getClient() *client.Client { ...@@ -86,6 +87,7 @@ func getClient() *client.Client {
if auClient == nil { if auClient == nil {
cli, err := clientv3.New(clientv3.Config{ cli, err := clientv3.New(clientv3.Config{
Endpoints: strings.Split(*etcdEndpoints, ","), Endpoints: strings.Split(*etcdEndpoints, ","),
DialOptions: []grpc.DialOption{grpc.WithBlock()},
DialTimeout: 5 * time.Second, DialTimeout: 5 * time.Second,
}) })
if err != nil { if err != nil {
......
...@@ -17,6 +17,7 @@ import ( ...@@ -17,6 +17,7 @@ import (
"go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/client/v3/concurrency" "go.etcd.io/etcd/client/v3/concurrency"
"go.etcd.io/etcd/server/v3/embed" "go.etcd.io/etcd/server/v3/embed"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
) )
...@@ -42,7 +43,8 @@ func createTestEtcd(t testing.TB) (*clientv3.Client, func()) { ...@@ -42,7 +43,8 @@ func createTestEtcd(t testing.TB) (*clientv3.Client, func()) {
<-e.Server.ReadyNotify() <-e.Server.ReadyNotify()
cli, err := clientv3.New(clientv3.Config{ cli, err := clientv3.New(clientv3.Config{
Endpoints: []string{"http://localhost:2379"}, Endpoints: []string{"http://localhost:2379"},
DialOptions: []grpc.DialOption{grpc.WithBlock()},
}) })
if err != nil { if err != nil {
t.Fatalf("clientv3.New: %v", err) t.Fatalf("clientv3.New: %v", err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment