Skip to content

Commit

Permalink
docs(testing): switch deprecated WithInsecure to WithTransportCredent…
Browse files Browse the repository at this point in the history
…ials (#10091)

The public [GRPC docs](https://pkg.go.dev/google.golang.org/grpc#WithInsecure) mention the following with regards to `grpc.WithInsecure`:

> Deprecated: use WithTransportCredentials and insecure.NewCredentials() instead. Will be supported throughout 1.x.

This change updates the example to use `WithTransportCredentials()` along with `insecure.NewCredentials()` instead of the deprecated option.
  • Loading branch information
mark-adams committed May 2, 2024
1 parent 966f83d commit 2b576ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ import (
"google.golang.org/api/option"
translatepb "google.golang.org/genproto/googleapis/cloud/translate/v3"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)

func TestTranslateTextWithConcreteClient(t *testing.T) {
Expand All @@ -123,7 +124,7 @@ func TestTranslateTextWithConcreteClient(t *testing.T) {
client, err := translate.NewTranslationClient(ctx,
option.WithEndpoint(fakeServerAddr),
option.WithoutAuthentication(),
option.WithGRPCDialOption(grpc.WithInsecure()),
option.WithGRPCDialOption(grpc.WithTransportCredentials(insecure.NewCredentials())),
)
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 2b576ab

Please sign in to comment.