diff options
author | Justin Tobler <jtobler@gitlab.com> | 2023-02-17 02:56:49 +0300 |
---|---|---|
committer | Justin Tobler <jtobler@gitlab.com> | 2023-02-20 21:32:41 +0300 |
commit | 924dc9fed07e9c43f54b543ea7c81e9583a71328 (patch) | |
tree | cfbdac4dddf1db6c94300613e8fc71467e11e274 | |
parent | d6ec16f1722bf061eb99070b382d2fb680d95ca1 (diff) |
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.
-rw-r--r-- | internal/gitaly/service/blob/lfs_pointers_test.go | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/internal/gitaly/service/blob/lfs_pointers_test.go b/internal/gitaly/service/blob/lfs_pointers_test.go index 4dee83fbf..21a536a5d 100644 --- a/internal/gitaly/service/blob/lfs_pointers_test.go +++ b/internal/gitaly/service/blob/lfs_pointers_test.go @@ -71,7 +71,8 @@ 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, _, repoInfo := setupRepoWithLFS(t, ctx, cfg) ctx = testhelper.MergeOutgoingMetadata(ctx, metadata.Pairs(catfile.SessionIDField, "1"), @@ -100,8 +101,8 @@ func TestListLFSPointers(t *testing.T) { lfsPointer1, lfsPointer2, lfsPointer3, - "d5b560e9c17384cf8257347db63167b54e0c97ff", // tree - "60ecb67744cb56576c30214ff52294f8ce2def98", // commit + repoInfo.defaultTreeID.String(), // tree + repoInfo.defaultCommitID.String(), // commit }, expectedPointers: []*gitalypb.LFSPointer{ lfsPointers[lfsPointer1], @@ -181,8 +182,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 { @@ -205,7 +204,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, }) @@ -221,7 +220,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", @@ -248,7 +247,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 @@ -297,12 +296,12 @@ size 12345` }) t.Run("no repository provided", func(t *testing.T) { - _, _, _, client := setup(t, ctx) - stram, err := client.ListAllLFSPointers(ctx, &gitalypb.ListAllLFSPointersRequest{ + _, _, _, client := setupWithLFS(t, ctx) + stream, err := client.ListAllLFSPointers(ctx, &gitalypb.ListAllLFSPointersRequest{ Repository: nil, }) require.NoError(t, err) - _, err = stram.Recv() + _, err = stream.Recv() testhelper.RequireGrpcError(t, status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( "empty Repository", "repo scoped: empty Repository", @@ -312,8 +311,8 @@ size 12345` func TestSuccessfulGetLFSPointersRequest(t *testing.T) { ctx := testhelper.Context(t) - - _, repo, _, client := setup(t, ctx) + cfg, client := setupWithoutRepo(t, ctx) + repo, _, repoInfo := setupRepoWithLFS(t, ctx, cfg) lfsPointerIds := []string{ lfsPointer1, @@ -321,8 +320,8 @@ func TestSuccessfulGetLFSPointersRequest(t *testing.T) { lfsPointer3, } otherObjectIds := []string{ - "d5b560e9c17384cf8257347db63167b54e0c97ff", // tree - "60ecb67744cb56576c30214ff52294f8ce2def98", // commit + repoInfo.defaultTreeID.String(), // tree + repoInfo.defaultCommitID.String(), // commit } expectedLFSPointers := []*gitalypb.LFSPointer{ @@ -357,7 +356,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 |