firestore: block when dialing mock server
We've seen the error
rpc error: code = Unavailable desc = grpc: the connection is unavailable
when running unit tests on Travis. Hoping this will help.
@@ -16,11 +16,12 @@ package firestore
import (
"fmt"
- "golang.org/x/net/context"
"reflect"
"testing"
"time"
+ "golang.org/x/net/context"
+
pb "google.golang.org/genproto/googleapis/firestore/v1beta1"
"github.com/golang/protobuf/proto"
@@ -87,7 +88,7 @@ func newMock(t *testing.T) (*Client, *mockServer) {
if err != nil {
t.Fatal(err)
}
- conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure())
+ conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure(), grpc.WithBlock())
if err != nil {
t.Fatal(err)
}
