Skip to content

Commit 7d251ac

Browse files
authoredJun 26, 2020
Merge pull request operator-framework#119 from ecordell/fix-test-flake
test(server): wait for connection to go healthy before running tests
2 parents f600d1f + fc46356 commit 7d251ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎pkg/server/server_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import (
66
"net"
77
"os"
88
"testing"
9+
"time"
910

1011
"github.com/sirupsen/logrus"
1112
"github.com/stretchr/testify/require"
1213
"golang.org/x/net/context"
1314
"google.golang.org/grpc"
15+
"google.golang.org/grpc/connectivity"
1416

1517
"github.com/operator-framework/operator-registry/pkg/api"
1618
"github.com/operator-framework/operator-registry/pkg/sqlite"
@@ -75,6 +77,10 @@ func client(t *testing.T) (api.RegistryClient, *grpc.ClientConn) {
7577
if err != nil {
7678
t.Fatalf("did not connect: %v", err)
7779
}
80+
81+
ctx, _ := context.WithTimeout(context.Background(), 30*time.Second)
82+
conn.WaitForStateChange(ctx, connectivity.TransientFailure)
83+
7884
return api.NewRegistryClient(conn), conn
7985
}
8086

0 commit comments

Comments
 (0)
Please sign in to comment.