From 1073bbb1ad1017d7ff3dcc59ae1293b494815f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Johan=20Ansari-=C3=96nnestam?= Date: Tue, 9 Apr 2024 07:40:50 +0200 Subject: [PATCH] chore: swap from DialContext to NewClient --- cmd/example-server/cmd.go | 3 +-- iamauthz/middleware_test.go | 6 ++---- iamexample/server_test.go | 4 +--- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/cmd/example-server/cmd.go b/cmd/example-server/cmd.go index a0ca172a..0c5366f2 100644 --- a/cmd/example-server/cmd.go +++ b/cmd/example-server/cmd.go @@ -22,8 +22,7 @@ func runMain(ctx context.Context) error { address := flag.String("address", "localhost:8080", "listen to address") spannerEmulatorHost := flag.String("spanner-emulator-host", "localhost:9010", "connect to emulator host") log.Printf("connecting to Spanner emulator on address %s...", *spannerEmulatorHost) - conn, err := grpc.DialContext( - ctx, + conn, err := grpc.NewClient( *spannerEmulatorHost, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock(), diff --git a/iamauthz/middleware_test.go b/iamauthz/middleware_test.go index 9780de78..2fe601ee 100644 --- a/iamauthz/middleware_test.go +++ b/iamauthz/middleware_test.go @@ -35,8 +35,7 @@ func TestRequireUnaryAuthorization(t *testing.T) { grpcServer.GracefulStop() }) ctx := withTestDeadline(context.Background(), t) - conn, err := grpc.DialContext( - ctx, + conn, err := grpc.NewClient( lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock(), @@ -68,8 +67,7 @@ func TestRequireUnaryAuthorization(t *testing.T) { grpcServer.GracefulStop() }) ctx := withTestDeadline(context.Background(), t) - conn, err := grpc.DialContext( - ctx, + conn, err := grpc.NewClient( lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock(), diff --git a/iamexample/server_test.go b/iamexample/server_test.go index dc757105..f06fdda0 100644 --- a/iamexample/server_test.go +++ b/iamexample/server_test.go @@ -115,9 +115,7 @@ func (ts *serverTestSuite) newTestFixture(t *testing.T) *serverTestFixture { t.Cleanup(func() { grpcServer.GracefulStop() }) - ctx := withTestDeadline(context.Background(), t) - conn, err := grpc.DialContext( - ctx, + conn, err := grpc.NewClient( lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock(),