Skip to content
Snippets Groups Projects
Commit 0478c5df authored by Justin Tobler's avatar Justin Tobler
Browse files

blob: Remove seeded repositories for LFS tests

Now with the ability to generate test repositories with LFS pointers on
the fly, update the LFS tests to stop using seed repositories.
parent 118a4b58
No related merge requests found
//go:build !gitaly_test_sha256
package blob
import (
......@@ -69,7 +67,9 @@ var lfsPointers = map[string]*gitalypb.LFSPointer{
func TestListLFSPointers(t *testing.T) {
ctx := testhelper.Context(t)
_, repo, _, client := setup(t, ctx)
cfg, client := setupWithoutRepo(t, ctx)
repo, repoPath := gittest.CreateRepository(t, ctx, cfg)
commitID, treeID := setupRepoWithLFS(t, cfg, repoPath)
ctx = testhelper.MergeOutgoingMetadata(ctx,
metadata.Pairs(catfile.SessionIDField, "1"),
......@@ -98,8 +98,8 @@ func TestListLFSPointers(t *testing.T) {
lfsPointer1,
lfsPointer2,
lfsPointer3,
"d5b560e9c17384cf8257347db63167b54e0c97ff", // tree
"60ecb67744cb56576c30214ff52294f8ce2def98", // commit
treeID.String(), // tree
commitID.String(), // commit
},
expectedPointers: []*gitalypb.LFSPointer{
lfsPointers[lfsPointer1],
......@@ -179,8 +179,6 @@ func TestListLFSPointers(t *testing.T) {
}
func TestListAllLFSPointers(t *testing.T) {
testhelper.SkipQuarantinedTest(t, "https://gitlab.com/gitlab-org/gitaly/-/issues/4793")
ctx := testhelper.Context(t)
receivePointers := func(t *testing.T, stream gitalypb.BlobService_ListAllLFSPointersClient) []*gitalypb.LFSPointer {
......@@ -203,7 +201,7 @@ oid sha256:1111111111111111111111111111111111111111111111111111111111111111
size 12345`
t.Run("normal repository", func(t *testing.T) {
_, repo, _, client := setup(t, ctx)
_, repo, _, client := setupWithLFS(t, ctx)
stream, err := client.ListAllLFSPointers(ctx, &gitalypb.ListAllLFSPointersRequest{
Repository: repo,
})
......@@ -219,7 +217,7 @@ size 12345`
})
t.Run("dangling LFS pointer", func(t *testing.T) {
cfg, repo, repoPath, client := setup(t, ctx)
cfg, repo, repoPath, client := setupWithLFS(t, ctx)
hash := gittest.ExecOpts(t, cfg, gittest.ExecConfig{Stdin: strings.NewReader(lfsPointerContents)},
"-C", repoPath, "hash-object", "-w", "--stdin",
......@@ -246,7 +244,7 @@ size 12345`
})
t.Run("quarantine", func(t *testing.T) {
cfg, repoProto, repoPath, client := setup(t, ctx)
cfg, repoProto, repoPath, client := setupWithLFS(t, ctx)
// We're emulating the case where git is receiving data via a push, where objects
// are stored in a separate quarantine environment. In this case, LFS pointer checks
......@@ -295,7 +293,7 @@ size 12345`
})
t.Run("no repository provided", func(t *testing.T) {
_, _, _, client := setup(t, ctx)
_, _, _, client := setupWithLFS(t, ctx)
stram, err := client.ListAllLFSPointers(ctx, &gitalypb.ListAllLFSPointersRequest{
Repository: nil,
})
......@@ -310,8 +308,9 @@ size 12345`
func TestSuccessfulGetLFSPointersRequest(t *testing.T) {
ctx := testhelper.Context(t)
_, repo, _, client := setup(t, ctx)
cfg, client := setupWithoutRepo(t, ctx)
repo, repoPath := gittest.CreateRepository(t, ctx, cfg)
commitID, treeID := setupRepoWithLFS(t, cfg, repoPath)
lfsPointerIds := []string{
lfsPointer1,
......@@ -319,8 +318,8 @@ func TestSuccessfulGetLFSPointersRequest(t *testing.T) {
lfsPointer3,
}
otherObjectIds := []string{
"d5b560e9c17384cf8257347db63167b54e0c97ff", // tree
"60ecb67744cb56576c30214ff52294f8ce2def98", // commit
treeID.String(), // tree
commitID.String(), // commit
}
expectedLFSPointers := []*gitalypb.LFSPointer{
......@@ -355,7 +354,7 @@ func TestSuccessfulGetLFSPointersRequest(t *testing.T) {
func TestFailedGetLFSPointersRequestDueToValidations(t *testing.T) {
ctx := testhelper.Context(t)
_, repo, _, client := setup(t, ctx)
_, repo, _, client := setupWithLFS(t, ctx)
testCases := []struct {
desc string
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment