Skip to content

Commit 35623f2

Browse files
committed
chore: Replace deprecated grpc.Dial calls
Signed-off-by: Philipp Schuler <philipp.schuler@command-b.de>
1 parent f0bd406 commit 35623f2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

protocol/pubsub/v2/internal/connection_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/google/go-cmp/cmp"
1919
"google.golang.org/api/option"
2020
"google.golang.org/grpc"
21+
"google.golang.org/grpc/credentials/insecure"
2122
"google.golang.org/protobuf/types/known/durationpb"
2223
)
2324

@@ -47,9 +48,9 @@ func (pc *testPubsubClient) New(ctx context.Context, projectID string, failureMa
4748
var err error
4849
var conn *grpc.ClientConn
4950
if len(failureMap) == 0 {
50-
conn, err = grpc.Dial(pc.srv.Addr, grpc.WithInsecure())
51+
conn, err = grpc.NewClient(pc.srv.Addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
5152
} else {
52-
conn, err = grpc.Dial(pc.srv.Addr, grpc.WithInsecure(), grpc.WithUnaryInterceptor(makeFailureIntercept(failureMap)))
53+
conn, err = grpc.NewClient(pc.srv.Addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithUnaryInterceptor(makeFailureIntercept(failureMap)))
5354

5455
}
5556
if err != nil {

protocol/pubsub/v2/protocol_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type testPubsubClient struct {
2424

2525
func (pc *testPubsubClient) NewWithAttributesInterceptor(ctx context.Context, projectID, orderingKey string) (*pubsub.Client, error) {
2626
pc.srv = pstest.NewServer()
27-
conn, err := grpc.Dial(pc.srv.Addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithUnaryInterceptor(customAttributesInterceptor(map[string]string{
27+
conn, err := grpc.NewClient(pc.srv.Addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithUnaryInterceptor(customAttributesInterceptor(map[string]string{
2828
"Content-Type": "text/json",
2929
"ce-dataschema": "http://example.com/schema",
3030
"ce-exbinary": "AAECAw==",
@@ -50,7 +50,7 @@ func (pc *testPubsubClient) NewWithAttributesInterceptor(ctx context.Context, pr
5050

5151
func (pc *testPubsubClient) NewWithOrderInterceptor(ctx context.Context, projectID, orderingKey string) (*pubsub.Client, error) {
5252
pc.srv = pstest.NewServer()
53-
conn, err := grpc.Dial(pc.srv.Addr, grpc.WithInsecure(), grpc.WithUnaryInterceptor(orderingKeyInterceptor(orderingKey)))
53+
conn, err := grpc.NewClient(pc.srv.Addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithUnaryInterceptor(orderingKeyInterceptor(orderingKey)))
5454
if err != nil {
5555
return nil, err
5656
}

0 commit comments

Comments
 (0)