diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-10-17 17:50:29 +0300 |
---|---|---|
committer | Paul Okstad <pokstad@gitlab.com> | 2019-10-17 17:50:29 +0300 |
commit | da0739ce764a3e8ba07d01982fa5f88ccf8d4c8b (patch) | |
tree | 250df638688aa1fde32732e2c405f9ce67037cf7 /internal | |
parent | 78de944558414c1ae8f97ed900ce303725fdea90 (diff) |
Remove RepositoryService WriteConfig
WriteConfig has gone unused, and deprecated for a long time. Originally
introduced in https://gitlab.com/gitlab-org/gitaly/merge_requests/554,
but got removed from the client in:
https://gitlab.com/gitlab-org/gitlab-foss/commit/ff112ce641a93f38647e67e4ed92b685ccc2430a
Given it's effectivally dead code, we should remove it.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/praefect/protoregistry/protoregistry_test.go | 1 | ||||
-rw-r--r-- | internal/service/repository/write_config.go | 22 | ||||
-rw-r--r-- | internal/service/repository/write_config_test.go | 88 |
3 files changed, 0 insertions, 111 deletions
diff --git a/internal/praefect/protoregistry/protoregistry_test.go b/internal/praefect/protoregistry/protoregistry_test.go index 569c304e1..f68804d67 100644 --- a/internal/praefect/protoregistry/protoregistry_test.go +++ b/internal/praefect/protoregistry/protoregistry_test.go @@ -139,7 +139,6 @@ func TestPopulatesProtoRegistry(t *testing.T) { "CreateRepositoryFromURL": protoregistry.OpMutator, "CreateBundle": protoregistry.OpMutator, "CreateRepositoryFromBundle": protoregistry.OpMutator, - "WriteConfig": protoregistry.OpMutator, "SetConfig": protoregistry.OpMutator, "DeleteConfig": protoregistry.OpMutator, "FindLicense": protoregistry.OpAccessor, diff --git a/internal/service/repository/write_config.go b/internal/service/repository/write_config.go deleted file mode 100644 index fe7d33c73..000000000 --- a/internal/service/repository/write_config.go +++ /dev/null @@ -1,22 +0,0 @@ -package repository - -import ( - "context" - - "gitlab.com/gitlab-org/gitaly/internal/rubyserver" - "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" -) - -func (s *server) WriteConfig(ctx context.Context, req *gitalypb.WriteConfigRequest) (*gitalypb.WriteConfigResponse, error) { - client, err := s.ruby.RepositoryServiceClient(ctx) - if err != nil { - return nil, err - } - - clientCtx, err := rubyserver.SetHeaders(ctx, req.GetRepository()) - if err != nil { - return nil, err - } - - return client.WriteConfig(clientCtx, req) -} diff --git a/internal/service/repository/write_config_test.go b/internal/service/repository/write_config_test.go deleted file mode 100644 index 32be7808d..000000000 --- a/internal/service/repository/write_config_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package repository - -import ( - "testing" - - "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitaly/internal/helper/text" - "gitlab.com/gitlab-org/gitaly/internal/testhelper" - "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" - "google.golang.org/grpc/codes" -) - -func TestWriteConfigSuccessful(t *testing.T) { - server, serverSocketPath := runRepoServer(t) - defer server.Stop() - - client, conn := newRepositoryClient(t, serverSocketPath) - defer conn.Close() - - testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t) - defer cleanupFn() - - testcases := []struct { - desc string - repo *gitalypb.Repository - path string - setPath string - }{ - { - desc: "valid repo and full_path", - repo: testRepo, - path: "fullpath.git", - setPath: "fullpath.git", - }, - { - desc: "empty full_path", - repo: testRepo, - setPath: "fullpath.git", // No change since `nil` is silently ignored - }, - } - - for _, tc := range testcases { - t.Run(tc.desc, func(t *testing.T) { - ctx, cancel := testhelper.Context() - defer cancel() - - c, err := client.WriteConfig(ctx, &gitalypb.WriteConfigRequest{Repository: tc.repo, FullPath: tc.path}) - require.NoError(t, err) - require.NotNil(t, c) - require.Empty(t, string(c.GetError())) - - actualConfig := testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "config", "gitlab.fullpath") - require.Equal(t, tc.setPath, text.ChompBytes(actualConfig)) - }) - } -} - -func TestWriteConfigFailure(t *testing.T) { - server, serverSocketPath := runRepoServer(t) - defer server.Stop() - - client, conn := newRepositoryClient(t, serverSocketPath) - defer conn.Close() - - testcases := []struct { - desc string - repo *gitalypb.Repository - path string - }{ - { - desc: "invalid repo", - repo: &gitalypb.Repository{StorageName: testhelper.DefaultStorageName, RelativePath: "non-existing.git"}, - path: "non-existing.git", - }, - } - - for _, tc := range testcases { - t.Run(tc.desc, func(t *testing.T) { - ctx, cancel := testhelper.Context() - defer cancel() - - c, err := client.WriteConfig(ctx, &gitalypb.WriteConfigRequest{Repository: tc.repo, FullPath: tc.path}) - testhelper.RequireGrpcError(t, err, codes.NotFound) - require.Nil(t, c) - require.Empty(t, c.GetError()) - }) - } -} |