diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2022-06-21 21:00:58 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2022-06-21 21:00:58 +0300 |
commit | 3dfb0d51f6a940ca858b8b5a92d9b53ca937a137 (patch) | |
tree | a94e6b169da9289f95c61eb31691c252bb51baa1 /internal/gitaly/server/auth_test.go | |
parent | c2b476bf52faf71cde1e6182a331887b2b0d2cf7 (diff) |
Replace deprecated WithInsecure with WithTransportCredentials
gRPC has deprecated the WithInsecure option in favor of the more
general WithTransportCredentials combined with insecure.NewCredentials.
This commit removes our usage of the deprecated option so we don't get
lint failures for using deprecated functionality when upgrading our
gRPC dependency.
Diffstat (limited to 'internal/gitaly/server/auth_test.go')
-rw-r--r-- | internal/gitaly/server/auth_test.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/gitaly/server/auth_test.go b/internal/gitaly/server/auth_test.go index ea8e4a691..e650fbd10 100644 --- a/internal/gitaly/server/auth_test.go +++ b/internal/gitaly/server/auth_test.go @@ -34,6 +34,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/health" healthpb "google.golang.org/grpc/health/grpc_health_v1" ) @@ -45,7 +46,7 @@ func TestMain(m *testing.M) { func TestSanity(t *testing.T) { serverSocketPath := runServer(t, testcfg.Build(t)) - conn, err := dial(serverSocketPath, []grpc.DialOption{grpc.WithInsecure()}) + conn, err := dial(serverSocketPath, []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}) require.NoError(t, err) t.Cleanup(func() { conn.Close() }) @@ -102,7 +103,7 @@ func TestAuthFailures(t *testing.T) { })) serverSocketPath := runServer(t, cfg) - connOpts := append(tc.opts, grpc.WithInsecure()) + connOpts := append(tc.opts, grpc.WithTransportCredentials(insecure.NewCredentials())) conn, err := dial(serverSocketPath, connOpts) require.NoError(t, err, tc.desc) t.Cleanup(func() { conn.Close() }) @@ -145,7 +146,7 @@ func TestAuthSuccess(t *testing.T) { })) serverSocketPath := runServer(t, cfg) - connOpts := append(tc.opts, grpc.WithInsecure()) + connOpts := append(tc.opts, grpc.WithTransportCredentials(insecure.NewCredentials())) conn, err := dial(serverSocketPath, connOpts) require.NoError(t, err, tc.desc) t.Cleanup(func() { conn.Close() }) @@ -176,7 +177,7 @@ func newOperationClient(t *testing.T, token, serverSocketPath string) (gitalypb. t.Helper() connOpts := []grpc.DialOption{ - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithPerRPCCredentials(gitalyauth.RPCCredentialsV2(token)), } conn, err := grpc.Dial(serverSocketPath, connOpts...) @@ -260,7 +261,7 @@ func runSecureServer(t *testing.T, cfg config.Cfg) string { func TestUnaryNoAuth(t *testing.T) { cfg := testcfg.Build(t, testcfg.WithBase(config.Cfg{Auth: auth.Config{Token: "testtoken"}})) path := runServer(t, cfg) - conn, err := grpc.Dial(path, grpc.WithInsecure()) + conn, err := grpc.Dial(path, grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err) defer testhelper.MustClose(t, conn) ctx := testhelper.Context(t) @@ -281,7 +282,7 @@ func TestStreamingNoAuth(t *testing.T) { cfg := testcfg.Build(t, testcfg.WithBase(config.Cfg{Auth: auth.Config{Token: "testtoken"}})) path := runServer(t, cfg) - conn, err := dial(path, []grpc.DialOption{grpc.WithInsecure()}) + conn, err := dial(path, []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}) require.NoError(t, err) t.Cleanup(func() { conn.Close() }) ctx := testhelper.Context(t) |