Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Cai <johncai86@gmail.com>2022-12-30 02:06:16 +0300
committerJohn Cai <jcai@gitlab.com>2023-01-09 20:40:34 +0300
commit019d05405d9d4c2b221d9bd45767ed2c807150df (patch)
tree0145741776cb55e9c93df0a40f8b54a64d083b76
parenta0ec0b89bbd0ffad1b5e56efe9cd9c0c18818537 (diff)
Refactor to use localrepo.WriteTestBlobjc-unify-commit-writes
Swap out calls to gittest.WriteBlob to localrepo.MustWriteBlob.
-rw-r--r--internal/git/gitpipe/catfile_object_test.go12
-rw-r--r--internal/git/gitpipe/pipeline_test.go6
-rw-r--r--internal/git/housekeeping/optimize_repository_test.go4
-rw-r--r--internal/git/lstree/list_entries_test.go2
-rw-r--r--internal/git/stats/repository_info_test.go100
-rw-r--r--internal/gitaly/service/blob/blobs_test.go9
-rw-r--r--internal/gitaly/service/blob/get_blob_test.go14
-rw-r--r--internal/gitaly/service/operations/tags_test.go7
-rw-r--r--internal/gitaly/service/ref/find_refs_by_oid_test.go4
-rw-r--r--internal/gitaly/service/ssh/upload_pack_test.go4
10 files changed, 97 insertions, 65 deletions
diff --git a/internal/git/gitpipe/catfile_object_test.go b/internal/git/gitpipe/catfile_object_test.go
index 6a7c21d67..6e9e858b9 100644
--- a/internal/git/gitpipe/catfile_object_test.go
+++ b/internal/git/gitpipe/catfile_object_test.go
@@ -1,11 +1,11 @@
package gitpipe
import (
- "bytes"
"context"
"errors"
"fmt"
"io"
+ "strings"
"testing"
"github.com/stretchr/testify/require"
@@ -28,12 +28,12 @@ func TestCatfileObject(t *testing.T) {
})
repo := localrepo.NewTestRepo(t, cfg, repoProto)
- blobA := gittest.WriteBlob(t, cfg, repoPath, bytes.Repeat([]byte("a"), 133))
- blobB := gittest.WriteBlob(t, cfg, repoPath, bytes.Repeat([]byte("b"), 127))
- blobC := gittest.WriteBlob(t, cfg, repoPath, bytes.Repeat([]byte("c"), 127))
- blobD := gittest.WriteBlob(t, cfg, repoPath, bytes.Repeat([]byte("d"), 129))
+ blobA := localrepo.MustWriteBlob(t, repo, "", strings.Repeat("a", 133))
+ blobB := localrepo.MustWriteBlob(t, repo, "", strings.Repeat("b", 127))
+ blobC := localrepo.MustWriteBlob(t, repo, "", strings.Repeat("c", 127))
+ blobD := localrepo.MustWriteBlob(t, repo, "", strings.Repeat("d", 129))
- blobID := gittest.WriteBlob(t, cfg, repoPath, []byte("contents"))
+ blobID := localrepo.MustWriteBlob(t, repo, "", "contents")
treeID := gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{
{Path: "branch-test.txt", Mode: "100644", OID: blobID},
})
diff --git a/internal/git/gitpipe/pipeline_test.go b/internal/git/gitpipe/pipeline_test.go
index cf9fcde9e..d491c5b77 100644
--- a/internal/git/gitpipe/pipeline_test.go
+++ b/internal/git/gitpipe/pipeline_test.go
@@ -27,9 +27,9 @@ func TestPipeline_revlist(t *testing.T) {
})
repo := localrepo.NewTestRepo(t, cfg, repoProto)
- blobA := gittest.WriteBlob(t, cfg, repoPath, []byte("blob a"))
- blobB := gittest.WriteBlob(t, cfg, repoPath, []byte("b"))
- blobC := gittest.WriteBlob(t, cfg, repoPath, []byte("longer blob c"))
+ blobA := localrepo.MustWriteBlob(t, repo, "", "blob a")
+ blobB := localrepo.MustWriteBlob(t, repo, "", "b")
+ blobC := localrepo.MustWriteBlob(t, repo, "", "longer blob c")
subtree := gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{
{Path: "subblob", Mode: "100644", OID: blobA},
diff --git a/internal/git/housekeeping/optimize_repository_test.go b/internal/git/housekeeping/optimize_repository_test.go
index 746ee9ad4..e74f649d5 100644
--- a/internal/git/housekeeping/optimize_repository_test.go
+++ b/internal/git/housekeeping/optimize_repository_test.go
@@ -567,8 +567,8 @@ func TestPruneIfNeeded(t *testing.T) {
// Write two blobs, one recent blob and one blob that is older than two weeks and that would
// thus get pruned.
- recentBlobID := gittest.WriteBlob(t, cfg, repoPath, []byte("recent"))
- staleBlobID := gittest.WriteBlob(t, cfg, repoPath, []byte("stale"))
+ recentBlobID := localrepo.MustWriteBlob(t, repo, "", "recent")
+ staleBlobID := localrepo.MustWriteBlob(t, repo, "", "stale")
twoWeeksAgo := time.Now().Add(-1 * 2 * 7 * 24 * time.Hour)
require.NoError(t, os.Chtimes(objectPath(staleBlobID), twoWeeksAgo, twoWeeksAgo))
diff --git a/internal/git/lstree/list_entries_test.go b/internal/git/lstree/list_entries_test.go
index 2c3ef8256..ff56c6951 100644
--- a/internal/git/lstree/list_entries_test.go
+++ b/internal/git/lstree/list_entries_test.go
@@ -22,7 +22,7 @@ func TestListEntries(t *testing.T) {
})
repo := localrepo.NewTestRepo(t, cfg, repoProto)
- blobID := gittest.WriteBlob(t, cfg, repoPath, []byte("blob contents"))
+ blobID := localrepo.MustWriteBlob(t, repo, "", "blob contents")
emptyTreeID := gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{})
treeWithBlob := gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{
{OID: blobID, Mode: "100644", Path: "nonexecutable"},
diff --git a/internal/git/stats/repository_info_test.go b/internal/git/stats/repository_info_test.go
index e7fa7582f..1f945cf3b 100644
--- a/internal/git/stats/repository_info_test.go
+++ b/internal/git/stats/repository_info_test.go
@@ -47,11 +47,11 @@ func TestRepositoryProfile(t *testing.T) {
require.Equal(t, uint64(blobs), looseObjects)
for _, blobID := range blobIDs {
- commitID := gittest.WriteCommit(t, cfg, repoPath,
- gittest.WithTreeEntries(gittest.TreeEntry{
+ commitID := localrepo.MustWriteCommit(t, repo,
+ localrepo.WithTreeEntries(localrepo.TreeEntry{
Mode: "100644", Path: "blob", OID: git.ObjectID(blobID),
- }),
- )
+ }))
+
gittest.Exec(t, cfg, "-C", repoPath, "update-ref", "refs/heads/"+blobID, commitID.String())
}
@@ -106,15 +106,15 @@ func TestLogObjectInfo(t *testing.T) {
logger, hook := test.NewNullLogger()
ctx := ctxlogrus.ToContext(ctx, logger.WithField("test", "logging"))
- _, repoPath1 := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
+ repoProto1, repoPath1 := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
SkipCreationViaService: true,
})
- gittest.WriteCommit(t, cfg, repoPath1, gittest.WithMessage("repo1"), gittest.WithBranch("main"))
+ localrepo.MustWriteCommit(t, localrepo.NewTestRepo(t, cfg, repoProto1), localrepo.WithMessage("repo1"), localrepo.WithBranch("main"))
- _, repoPath2 := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
+ repoProto2, repoPath2 := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
SkipCreationViaService: true,
})
- gittest.WriteCommit(t, cfg, repoPath2, gittest.WithMessage("repo2"), gittest.WithBranch("main"))
+ localrepo.MustWriteCommit(t, localrepo.NewTestRepo(t, cfg, repoProto2), localrepo.WithMessage("repo2"), localrepo.WithBranch("main"))
// clone existing local repo with two alternates
targetRepoName := gittest.NewRepositoryName(t)
@@ -147,12 +147,13 @@ func TestLogObjectInfo(t *testing.T) {
logger, hook := test.NewNullLogger()
ctx := ctxlogrus.ToContext(ctx, logger.WithField("test", "logging"))
- repo, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
+ repo, _ := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
SkipCreationViaService: true,
})
- gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch("main"))
+ localRepo := localrepo.NewTestRepo(t, cfg, repo)
+ localrepo.MustWriteCommit(t, localRepo, localrepo.WithBranch("main"))
- LogRepositoryInfo(ctx, localrepo.NewTestRepo(t, cfg, repo))
+ LogRepositoryInfo(ctx, localRepo)
objectsInfo := requireRepositoryInfo(hook.AllEntries())
require.Equal(t, RepositoryInfo{
@@ -180,19 +181,19 @@ func TestRepositoryInfoForRepository(t *testing.T) {
for _, tc := range []struct {
desc string
- setup func(t *testing.T, repoPath string)
+ setup func(t *testing.T, repo *localrepo.Repo)
expectedErr error
expectedInfo RepositoryInfo
}{
{
desc: "empty repository",
- setup: func(*testing.T, string) {
+ setup: func(*testing.T, *localrepo.Repo) {
},
},
{
desc: "single blob",
- setup: func(t *testing.T, repoPath string) {
- gittest.WriteBlob(t, cfg, repoPath, []byte("x"))
+ setup: func(t *testing.T, repo *localrepo.Repo) {
+ localrepo.MustWriteBlob(t, repo, "", "x")
},
expectedInfo: RepositoryInfo{
LooseObjects: LooseObjectsInfo{
@@ -203,8 +204,12 @@ func TestRepositoryInfoForRepository(t *testing.T) {
},
{
desc: "single packed blob",
- setup: func(t *testing.T, repoPath string) {
- blobID := gittest.WriteBlob(t, cfg, repoPath, []byte("x"))
+ setup: func(t *testing.T, repo *localrepo.Repo) {
+ repoPath, err := repo.Path()
+ require.NoError(t, err)
+
+ blobID := localrepo.MustWriteBlob(t, repo, "", "x")
+
gittest.WriteRef(t, cfg, repoPath, "refs/tags/blob", blobID)
// We use `-d`, which also prunes objects that have been packed.
gittest.Exec(t, cfg, "-C", repoPath, "repack", "-Ad")
@@ -222,8 +227,12 @@ func TestRepositoryInfoForRepository(t *testing.T) {
},
{
desc: "single pruneable blob",
- setup: func(t *testing.T, repoPath string) {
- blobID := gittest.WriteBlob(t, cfg, repoPath, []byte("x"))
+ setup: func(t *testing.T, repo *localrepo.Repo) {
+ repoPath, err := repo.Path()
+ require.NoError(t, err)
+
+ blobID := localrepo.MustWriteBlob(t, repo, "", "x")
+
gittest.WriteRef(t, cfg, repoPath, "refs/tags/blob", blobID)
// This time we don't use `-d`, so the object will exist both in
// loose and packed form.
@@ -246,7 +255,10 @@ func TestRepositoryInfoForRepository(t *testing.T) {
},
{
desc: "garbage",
- setup: func(t *testing.T, repoPath string) {
+ setup: func(t *testing.T, repo *localrepo.Repo) {
+ repoPath, err := repo.Path()
+ require.NoError(t, err)
+
garbagePath := filepath.Join(repoPath, "objects", "pack", "garbage")
require.NoError(t, os.WriteFile(garbagePath, []byte("x"), 0o600))
},
@@ -259,7 +271,10 @@ func TestRepositoryInfoForRepository(t *testing.T) {
},
{
desc: "alternates",
- setup: func(t *testing.T, repoPath string) {
+ setup: func(t *testing.T, repo *localrepo.Repo) {
+ repoPath, err := repo.Path()
+ require.NoError(t, err)
+
infoAlternatesPath := filepath.Join(repoPath, "objects", "info", "alternates")
require.NoError(t, os.WriteFile(infoAlternatesPath, []byte(alternatePath), 0o600))
},
@@ -271,7 +286,11 @@ func TestRepositoryInfoForRepository(t *testing.T) {
},
{
desc: "non-split commit-graph without bloom filter and generation data",
- setup: func(t *testing.T, repoPath string) {
+ setup: func(t *testing.T, repo *localrepo.Repo) {
+ localrepo.MustWriteCommit(t, repo, localrepo.WithBranch("main"))
+ repoPath, err := repo.Path()
+ require.NoError(t, err)
+
gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch("main"))
gittest.Exec(t, cfg, "-C", repoPath,
"-c", "commitGraph.generationVersion=1",
@@ -293,8 +312,11 @@ func TestRepositoryInfoForRepository(t *testing.T) {
},
{
desc: "non-split commit-graph with bloom filter and no generation data",
- setup: func(t *testing.T, repoPath string) {
- gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch("main"))
+ setup: func(t *testing.T, repo *localrepo.Repo) {
+ localrepo.MustWriteCommit(t, repo, localrepo.WithBranch("main"))
+ repoPath, err := repo.Path()
+ require.NoError(t, err)
+
gittest.Exec(t, cfg, "-C", repoPath,
"-c", "commitGraph.generationVersion=1",
"commit-graph", "write", "--reachable", "--changed-paths",
@@ -316,8 +338,11 @@ func TestRepositoryInfoForRepository(t *testing.T) {
},
{
desc: "non-split commit-graph with bloom filters and generation data",
- setup: func(t *testing.T, repoPath string) {
- gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch("main"))
+ setup: func(t *testing.T, repo *localrepo.Repo) {
+ localrepo.MustWriteCommit(t, repo, localrepo.WithBranch("main"))
+
+ repoPath, err := repo.Path()
+ require.NoError(t, err)
gittest.Exec(t, cfg, "-C", repoPath,
"-c",
"commitGraph.generationVersion=2",
@@ -344,18 +369,21 @@ func TestRepositoryInfoForRepository(t *testing.T) {
},
{
desc: "all together",
- setup: func(t *testing.T, repoPath string) {
+ setup: func(t *testing.T, repo *localrepo.Repo) {
+ repoPath, err := repo.Path()
+ require.NoError(t, err)
+
infoAlternatesPath := filepath.Join(repoPath, "objects", "info", "alternates")
require.NoError(t, os.WriteFile(infoAlternatesPath, []byte(alternatePath), 0o600))
// We write a single packed blob.
- blobID := gittest.WriteBlob(t, cfg, repoPath, []byte("x"))
+ blobID := localrepo.MustWriteBlob(t, repo, "", "x")
gittest.WriteRef(t, cfg, repoPath, "refs/tags/blob", blobID)
gittest.Exec(t, cfg, "-C", repoPath, "repack", "-Ad")
// And two loose ones.
- gittest.WriteBlob(t, cfg, repoPath, []byte("1"))
- gittest.WriteBlob(t, cfg, repoPath, []byte("2"))
+ localrepo.MustWriteBlob(t, repo, "", "1")
+ localrepo.MustWriteBlob(t, repo, "", "2")
// And three garbage-files. This is done so we've got unique counts
// everywhere.
@@ -386,12 +414,12 @@ func TestRepositoryInfoForRepository(t *testing.T) {
},
} {
t.Run(tc.desc, func(t *testing.T) {
- repoProto, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
+ repoProto, _ := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
SkipCreationViaService: true,
})
repo := localrepo.NewTestRepo(t, cfg, repoProto)
- tc.setup(t, repoPath)
+ tc.setup(t, repo)
repoInfo, err := RepositoryInfoForRepository(ctx, repo)
require.Equal(t, tc.expectedErr, err)
@@ -418,8 +446,8 @@ func TestReferencesInfoForRepository(t *testing.T) {
},
{
desc: "single unpacked reference",
- setup: func(t *testing.T, _ *localrepo.Repo, repoPath string) {
- gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch("main"))
+ setup: func(t *testing.T, repo *localrepo.Repo, repoPath string) {
+ localrepo.MustWriteCommit(t, repo, localrepo.WithBranch("main"))
},
expectedInfo: ReferencesInfo{
LooseReferencesCount: 1,
@@ -439,13 +467,13 @@ func TestReferencesInfoForRepository(t *testing.T) {
},
{
desc: "multiple unpacked and packed refs",
- setup: func(t *testing.T, _ *localrepo.Repo, repoPath string) {
+ setup: func(t *testing.T, repo *localrepo.Repo, repoPath string) {
for _, ref := range []string{
"refs/heads/main",
"refs/something",
"refs/merge-requests/1/HEAD",
} {
- gittest.WriteCommit(t, cfg, repoPath, gittest.WithReference(ref))
+ localrepo.MustWriteCommit(t, repo, localrepo.WithReference(ref))
}
// We just write some random garbage -- we don't verify contents
diff --git a/internal/gitaly/service/blob/blobs_test.go b/internal/gitaly/service/blob/blobs_test.go
index 8a38ad257..d41e2064b 100644
--- a/internal/gitaly/service/blob/blobs_test.go
+++ b/internal/gitaly/service/blob/blobs_test.go
@@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git/gittest"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/git/quarantine"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
@@ -39,10 +40,10 @@ func TestListBlobs(t *testing.T) {
streamio.WriteBufferSize = 200
ctx := testhelper.Context(t)
- cfg, repoProto, repoPath, client := setup(t, ctx)
+ cfg, repoProto, _, client := setup(t, ctx)
bigBlobContents := bytes.Repeat([]byte{1}, streamio.WriteBufferSize*2+1)
- bigBlobOID := gittest.WriteBlob(t, cfg, repoPath, bigBlobContents)
+ bigBlobOID := localrepo.MustWriteBlob(t, localrepo.NewTestRepo(t, cfg, repoProto), "", string(bigBlobContents))
for _, tc := range []struct {
desc string
@@ -302,8 +303,8 @@ func TestListAllBlobs(t *testing.T) {
emptyRepo, _ := gittest.CreateRepository(t, ctx, cfg)
- singleBlobRepo, singleBlobRepoPath := gittest.CreateRepository(t, ctx, cfg)
- blobID := gittest.WriteBlob(t, cfg, singleBlobRepoPath, []byte("foobar"))
+ singleBlobRepo, _ := gittest.CreateRepository(t, ctx, cfg)
+ blobID := localrepo.MustWriteBlob(t, localrepo.NewTestRepo(t, cfg, singleBlobRepo), "", "foobar")
for _, tc := range []struct {
desc string
diff --git a/internal/gitaly/service/blob/get_blob_test.go b/internal/gitaly/service/blob/get_blob_test.go
index dc464100d..c3ff616af 100644
--- a/internal/gitaly/service/blob/get_blob_test.go
+++ b/internal/gitaly/service/blob/get_blob_test.go
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git/gittest"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/structerr"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
@@ -21,14 +22,15 @@ func TestGetBlob_successful(t *testing.T) {
ctx := testhelper.Context(t)
cfg, client := setupWithoutRepo(t, ctx)
- repo, repoPath := gittest.CreateRepository(t, ctx, cfg)
+ repoProto, _ := gittest.CreateRepository(t, ctx, cfg)
+ repo := localrepo.NewTestRepo(t, cfg, repoProto)
smallBlobContents := []byte("small blob")
smallBlobLen := int64(len(smallBlobContents))
- smallBlobID := gittest.WriteBlob(t, cfg, repoPath, smallBlobContents)
+ smallBlobID := localrepo.MustWriteBlob(t, repo, "", string(smallBlobContents))
largeBlobContents := bytes.Repeat([]byte{1}, 1024*1024)
- largeBlobID := gittest.WriteBlob(t, cfg, repoPath, largeBlobContents)
+ largeBlobID := localrepo.MustWriteBlob(t, repo, "", string(largeBlobContents))
for _, tc := range []struct {
desc string
@@ -74,7 +76,7 @@ func TestGetBlob_successful(t *testing.T) {
} {
t.Run(tc.desc, func(t *testing.T) {
stream, err := client.GetBlob(ctx, &gitalypb.GetBlobRequest{
- Repository: repo,
+ Repository: repoProto,
Oid: tc.oid,
Limit: tc.limit,
})
@@ -144,8 +146,8 @@ func TestGetBlob_invalidRequest(t *testing.T) {
ctx := testhelper.Context(t)
cfg, client := setupWithoutRepo(t, ctx)
- repo, repoPath := gittest.CreateRepository(t, ctx, cfg)
- oid := gittest.WriteBlob(t, cfg, repoPath, []byte("something")).String()
+ repo, _ := gittest.CreateRepository(t, ctx, cfg)
+ oid := localrepo.MustWriteBlob(t, localrepo.NewTestRepo(t, cfg, repo), "", "something").String()
for _, tc := range []struct {
desc string
diff --git a/internal/gitaly/service/operations/tags_test.go b/internal/gitaly/service/operations/tags_test.go
index b2aac01dd..2e9b2c81f 100644
--- a/internal/gitaly/service/operations/tags_test.go
+++ b/internal/gitaly/service/operations/tags_test.go
@@ -781,8 +781,9 @@ func TestUserCreateTag_nonCommitTarget(t *testing.T) {
ctx := testhelper.Context(t)
ctx, cfg, client := setupOperationsServiceWithoutRepo(t, ctx)
- repo, repoPath := gittest.CreateRepository(t, ctx, cfg)
- blobID := gittest.WriteBlob(t, cfg, repoPath, []byte("content"))
+ repoProto, repoPath := gittest.CreateRepository(t, ctx, cfg)
+ repo := localrepo.NewTestRepo(t, cfg, repoProto)
+ blobID := localrepo.MustWriteBlob(t, repo, "", "content")
treeID := gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{
{Path: "file", Mode: "100644", Content: "something"},
})
@@ -845,7 +846,7 @@ func TestUserCreateTag_nonCommitTarget(t *testing.T) {
writeAssertObjectTypeUpdateHook(t, repoPath, tc.expectedObjectType)
response, err := client.UserCreateTag(ctx, &gitalypb.UserCreateTagRequest{
- Repository: repo,
+ Repository: repoProto,
TagName: []byte(tc.tagName),
TargetRevision: []byte(tc.targetRevision),
User: gittest.TestUser,
diff --git a/internal/gitaly/service/ref/find_refs_by_oid_test.go b/internal/gitaly/service/ref/find_refs_by_oid_test.go
index 735118c1a..878b9354e 100644
--- a/internal/gitaly/service/ref/find_refs_by_oid_test.go
+++ b/internal/gitaly/service/ref/find_refs_by_oid_test.go
@@ -177,10 +177,10 @@ func TestFindRefsByOID_failure(t *testing.T) {
{
desc: "oid is not a commit",
setup: func(t *testing.T) (*gitalypb.FindRefsByOIDRequest, error) {
- repo, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
+ repo, _ := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
Seed: gittest.SeedGitLabTest,
})
- oid := gittest.WriteBlob(t, cfg, repoPath, []byte("the blob"))
+ oid := localrepo.MustWriteBlob(t, localrepo.NewTestRepo(t, cfg, repo), "", "the blob")
return &gitalypb.FindRefsByOIDRequest{
Repository: repo,
diff --git a/internal/gitaly/service/ssh/upload_pack_test.go b/internal/gitaly/service/ssh/upload_pack_test.go
index 2dce494db..43dd9dc87 100644
--- a/internal/gitaly/service/ssh/upload_pack_test.go
+++ b/internal/gitaly/service/ssh/upload_pack_test.go
@@ -518,8 +518,8 @@ func testUploadPackSuccessful(t *testing.T, sidechannel bool, opts ...testcfg.Op
repo, repoPath := gittest.CreateRepository(t, ctx, cfg)
- smallBlobID := gittest.WriteBlob(t, cfg, repoPath, []byte("foobar"))
- largeBlobID := gittest.WriteBlob(t, cfg, repoPath, bytes.Repeat([]byte("1"), 2048))
+ smallBlobID := localrepo.MustWriteBlob(t, repo, "", "foobar")
+ largeBlobID := localrepo.MustWriteBlob(t, repo, "", strings.Repeat("1", 2048))
// We set up the commits so that HEAD does not reference the above two blobs. If it did we'd
// fetch the blobs regardless of `--filter=blob:limit`.