Skip to content

Commit

Permalink
chore: swap from DialContext to NewClient
Browse files Browse the repository at this point in the history
  • Loading branch information
quoral committed Apr 9, 2024
1 parent 66c3c92 commit 1073bbb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
3 changes: 1 addition & 2 deletions cmd/example-server/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
6 changes: 2 additions & 4 deletions iamauthz/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
4 changes: 1 addition & 3 deletions iamexample/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 1073bbb

Please sign in to comment.