diff options
author | Toon Claes <toon@gitlab.com> | 2023-10-20 10:24:09 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2023-10-20 10:24:09 +0300 |
commit | 2173549bcc4093b1dfe78ba3cbd8cd73234d6f3f (patch) | |
tree | d7ada48342c1be85496de82540932245d1e98f47 | |
parent | 43df87b07ab51de20c0954ef98857df7acc48cde (diff) | |
parent | 64ee64a4d30f6076aad214dc4ddb28cd18b1d59c (diff) |
Merge branch 'smh-fix-broken-test' into 'master'
Fix broken test performing concurrent writes to shared repo
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6483
Merged-by: Toon Claes <toon@gitlab.com>
Approved-by: Toon Claes <toon@gitlab.com>
Approved-by: Will Chandler <wchandler@gitlab.com>
Co-authored-by: Sami Hiltunen <shiltunen@gitlab.com>
-rw-r--r-- | internal/gitaly/service/operations/rebase_to_ref_test.go | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/internal/gitaly/service/operations/rebase_to_ref_test.go b/internal/gitaly/service/operations/rebase_to_ref_test.go index e178b595a..559ca5fcd 100644 --- a/internal/gitaly/service/operations/rebase_to_ref_test.go +++ b/internal/gitaly/service/operations/rebase_to_ref_test.go @@ -96,8 +96,8 @@ func testUserRebaseToRefFailure(t *testing.T, ctx context.Context) { mergeBaseOID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithMessage("first commit")) - validTargetRef := []byte("refs/merge-requests/x/merge") - validTargetRefOID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithMessage("commit to target ref")) + validTargetRef := "refs/merge-requests/x/merge" + gittest.WriteCommit(t, cfg, repoPath, gittest.WithMessage("commit to target ref"), gittest.WithReference(validTargetRef)) validSourceOID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithMessage("commit source SHA"), gittest.WithParents(mergeBaseOID)) validSourceSha := validSourceOID.String() validFirstParentRef := []byte("refs/heads/main") @@ -107,7 +107,7 @@ func testUserRebaseToRefFailure(t *testing.T, ctx context.Context) { desc string repo *gitalypb.Repository user *gitalypb.User - targetRef []byte + targetRef string sourceSha string firstParentRef []byte expectedOldOID string @@ -158,7 +158,7 @@ func testUserRebaseToRefFailure(t *testing.T, ctx context.Context) { desc: "invalid target ref", repo: repo, user: gittest.TestUser, - targetRef: []byte("refs/heads/branch"), + targetRef: "refs/heads/branch", sourceSha: validSourceSha, firstParentRef: validFirstParentRef, expectedError: structerr.NewInvalidArgument("%w", errors.New("invalid TargetRef")), @@ -186,7 +186,7 @@ func testUserRebaseToRefFailure(t *testing.T, ctx context.Context) { desc: "ambiguous target reference", repo: repo, user: gittest.TestUser, - targetRef: []byte("refs/merge-requests/x/m*"), + targetRef: "refs/merge-requests/x/m*", sourceSha: validSourceSha, firstParentRef: validFirstParentRef, expectedError: structerr.NewInvalidArgument(`target reference is ambiguous: reference is ambiguous: conflicts with "refs/merge-requests/x/merge"`), @@ -195,16 +195,13 @@ func testUserRebaseToRefFailure(t *testing.T, ctx context.Context) { for _, tc := range testCases { tc := tc - t.Run(tc.desc, func(t *testing.T) { t.Parallel() - // reset target ref between tests - gittest.WriteRef(t, cfg, repoPath, git.ReferenceName(validTargetRef), validTargetRefOID) request := &gitalypb.UserRebaseToRefRequest{ Repository: tc.repo, User: tc.user, - TargetRef: tc.targetRef, + TargetRef: []byte(tc.targetRef), SourceSha: tc.sourceSha, FirstParentRef: tc.firstParentRef, ExpectedOldOid: tc.expectedOldOID, |