diff options
Diffstat (limited to 'internal/gitaly/service/repository/search_files_test.go')
-rw-r--r-- | internal/gitaly/service/repository/search_files_test.go | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/internal/gitaly/service/repository/search_files_test.go b/internal/gitaly/service/repository/search_files_test.go index 8a4e03986..7e04d9968 100644 --- a/internal/gitaly/service/repository/search_files_test.go +++ b/internal/gitaly/service/repository/search_files_test.go @@ -12,6 +12,8 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/backchannel" "gitlab.com/gitlab-org/gitaly/internal/git" + "gitlab.com/gitlab-org/gitaly/internal/git/catfile" + "gitlab.com/gitlab-org/gitaly/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/internal/gitaly/transaction" "gitlab.com/gitlab-org/gitaly/internal/testhelper" @@ -150,7 +152,7 @@ func TestSearchFilesByContentLargeFile(t *testing.T) { ctx, cancel := testhelper.Context() defer cancel() - _, repo, repoPath, client := setupRepositoryServiceWithWorktree(t) + cfg, repo, repoPath, client := setupRepositoryServiceWithWorktree(t) committerName := "Scrooge McDuck" committerEmail := "scrooge@mcduck.com" @@ -178,8 +180,8 @@ func TestSearchFilesByContentLargeFile(t *testing.T) { for _, largeFile := range largeFiles { t.Run(largeFile.filename, func(t *testing.T) { require.NoError(t, ioutil.WriteFile(filepath.Join(repoPath, largeFile.filename), bytes.Repeat([]byte(largeFile.line), largeFile.repeated), 0644)) - testhelper.MustRunCommand(t, nil, "git", "-C", repoPath, "add", ".") - testhelper.MustRunCommand(t, nil, "git", "-C", repoPath, + gittest.Exec(t, cfg, "-C", repoPath, "add", ".") + gittest.Exec(t, cfg, "-C", repoPath, "-c", fmt.Sprintf("user.name=%s", committerName), "-c", fmt.Sprintf("user.email=%s", committerEmail), "commit", "-m", "large file commit", "--", largeFile.filename) @@ -201,7 +203,16 @@ func TestSearchFilesByContentLargeFile(t *testing.T) { func TestSearchFilesByContentFailure(t *testing.T) { cfg, repo, _ := testcfg.BuildWithRepo(t) - server := NewServer(cfg, nil, config.NewLocator(cfg), transaction.NewManager(cfg, backchannel.NewRegistry()), git.NewExecCommandFactory(cfg)) + gitCommandFactory := git.NewExecCommandFactory(cfg) + + server := NewServer( + cfg, + nil, + config.NewLocator(cfg), + transaction.NewManager(cfg, backchannel.NewRegistry()), + gitCommandFactory, + catfile.NewCache(cfg), + ) testCases := []struct { desc string @@ -313,7 +324,16 @@ func TestSearchFilesByNameSuccessful(t *testing.T) { func TestSearchFilesByNameFailure(t *testing.T) { cfg := testcfg.Build(t) - server := NewServer(cfg, nil, config.NewLocator(cfg), transaction.NewManager(cfg, backchannel.NewRegistry()), git.NewExecCommandFactory(cfg)) + gitCommandFactory := git.NewExecCommandFactory(cfg) + + server := NewServer( + cfg, + nil, + config.NewLocator(cfg), + transaction.NewManager(cfg, backchannel.NewRegistry()), + gitCommandFactory, + catfile.NewCache(cfg), + ) testCases := []struct { desc string |