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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-12-06 09:49:50 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-12-06 09:50:11 +0300
commitddfe5c04ef463e76b5b021415a915fcc055c2fa7 (patch)
treef08ded4873af3b2d403e1fd4caaa9d4ce4c70e34 /internal/gitaly/service/operations
parent555260f1579aca1dcb8494c0d505971c861b673a (diff)
testhelper: Absorb helpers from the testassert package
Personally, whenever I want to compare gRPC errors and/or messages, I stand there asking myself where the helper I want is located again. This is caused by a split we have in test helpers related to gRPC: while we do have `testhelper.RequireGrpcError()`, checking for actual errors is done via `testassert.GrpcEqualErr()`. I always have to look up which of both does what and where it's located. Fix this by absorbing the helpers from the testassert package into the testhelper package.
Diffstat (limited to 'internal/gitaly/service/operations')
-rw-r--r--internal/gitaly/service/operations/apply_patch_test.go7
-rw-r--r--internal/gitaly/service/operations/branches_test.go11
-rw-r--r--internal/gitaly/service/operations/cherry_pick_test.go5
-rw-r--r--internal/gitaly/service/operations/commit_files_test.go3
-rw-r--r--internal/gitaly/service/operations/merge_test.go33
-rw-r--r--internal/gitaly/service/operations/rebase_test.go3
-rw-r--r--internal/gitaly/service/operations/squash_test.go11
-rw-r--r--internal/gitaly/service/operations/tags_test.go39
-rw-r--r--internal/gitaly/service/operations/update_branches_test.go13
9 files changed, 58 insertions, 67 deletions
diff --git a/internal/gitaly/service/operations/apply_patch_test.go b/internal/gitaly/service/operations/apply_patch_test.go
index 5b99206d1..220c20227 100644
--- a/internal/gitaly/service/operations/apply_patch_test.go
+++ b/internal/gitaly/service/operations/apply_patch_test.go
@@ -23,7 +23,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/v14/internal/metadata"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
- "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver"
"gitlab.com/gitlab-org/gitaly/v14/internal/transaction/txinfo"
@@ -389,7 +388,7 @@ To restore the original branch and stop patching, run "git am --abort".
actualResponse, err := stream.CloseAndRecv()
if tc.error != nil {
- testassert.GrpcEqualErr(t, tc.error, err)
+ testhelper.GrpcEqualErr(t, tc.error, err)
return
}
@@ -397,7 +396,7 @@ To restore the original branch and stop patching, run "git am --abort".
commitID := actualResponse.GetBranchUpdate().GetCommitId()
actualResponse.GetBranchUpdate().CommitId = ""
- testassert.ProtoEqual(t, &gitalypb.UserApplyPatchResponse{
+ testhelper.ProtoEqual(t, &gitalypb.UserApplyPatchResponse{
BranchUpdate: &gitalypb.OperationBranchUpdate{
RepoCreated: false,
BranchCreated: tc.branchCreated,
@@ -417,7 +416,7 @@ To restore the original branch and stop patching, run "git am --abort".
expectedBody := []byte("commit subject\n\ncommit message body\n")
expectedTimezone := []byte("+0000")
- testassert.ProtoEqual(t,
+ testhelper.ProtoEqual(t,
&gitalypb.GitCommit{
Id: commitID,
Subject: []byte("commit subject"),
diff --git a/internal/gitaly/service/operations/branches_test.go b/internal/gitaly/service/operations/branches_test.go
index ceb04b9fd..57bd8bd81 100644
--- a/internal/gitaly/service/operations/branches_test.go
+++ b/internal/gitaly/service/operations/branches_test.go
@@ -14,7 +14,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/hook"
"gitlab.com/gitlab-org/gitaly/v14/internal/metadata"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
- "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver"
"gitlab.com/gitlab-org/gitaly/v14/internal/transaction/txinfo"
@@ -290,7 +289,7 @@ func TestSuccessfulCreateBranchRequestWithStartPointRefPrefix(t *testing.T) {
TargetCommit: targetCommitOK,
},
}
- testassert.ProtoEqual(t, responseOk, response)
+ testhelper.ProtoEqual(t, responseOk, response)
branches := gittest.Exec(t, cfg, "-C", repoPath, "for-each-ref", "--", "refs/heads/"+testCase.branchName)
require.Contains(t, string(branches), "refs/heads/"+testCase.branchName)
})
@@ -380,7 +379,7 @@ func TestFailedUserCreateBranchRequest(t *testing.T) {
}
response, err := client.UserCreateBranch(ctx, request)
- testassert.GrpcEqualErr(t, testCase.err, err)
+ testhelper.GrpcEqualErr(t, testCase.err, err)
require.Empty(t, response)
})
}
@@ -435,7 +434,7 @@ func TestSuccessfulUserDeleteBranchRequest(t *testing.T) {
User: testCase.user,
})
require.NoError(t, err)
- testassert.ProtoEqual(t, testCase.response, response)
+ testhelper.ProtoEqual(t, testCase.response, response)
refs := gittest.Exec(t, cfg, "-C", repoPath, "for-each-ref", "--", "refs/heads/"+testCase.branchNameInput)
require.NotContains(t, string(refs), testCase.branchCommit, "branch deleted from refs")
@@ -572,8 +571,8 @@ func TestFailedUserDeleteBranchDueToValidation(t *testing.T) {
for _, testCase := range testCases {
t.Run(testCase.desc, func(t *testing.T) {
response, err := client.UserDeleteBranch(ctx, testCase.request)
- testassert.GrpcEqualErr(t, testCase.err, err)
- testassert.ProtoEqual(t, testCase.response, response)
+ testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.ProtoEqual(t, testCase.response, response)
})
}
}
diff --git a/internal/gitaly/service/operations/cherry_pick_test.go b/internal/gitaly/service/operations/cherry_pick_test.go
index 0e291daa1..ae3f591b6 100644
--- a/internal/gitaly/service/operations/cherry_pick_test.go
+++ b/internal/gitaly/service/operations/cherry_pick_test.go
@@ -11,7 +11,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
- "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
"google.golang.org/protobuf/types/known/timestamppb"
@@ -164,7 +163,7 @@ func TestServer_UserCherryPick_successful(t *testing.T) {
require.Empty(t, response.CreateTreeErrorCode)
if testCase.request.DryRun {
- testassert.ProtoEqual(t, masterHeadCommit, headCommit)
+ testhelper.ProtoEqual(t, masterHeadCommit, headCommit)
} else {
require.Equal(t, testCase.request.Message, headCommit.Subject)
require.Equal(t, masterHeadCommit.Id, headCommit.ParentIds[0])
@@ -525,7 +524,7 @@ func TestServer_UserCherryPick_successfulWithGivenCommits(t *testing.T) {
BranchUpdate: &gitalypb.OperationBranchUpdate{CommitId: newHead.Id},
}
- testassert.ProtoEqual(t, expectedResponse, response)
+ testhelper.ProtoEqual(t, expectedResponse, response)
require.Equal(t, request.Message, newHead.Subject)
require.Equal(t, testCase.startRevision.String(), newHead.ParentIds[0])
diff --git a/internal/gitaly/service/operations/commit_files_test.go b/internal/gitaly/service/operations/commit_files_test.go
index b98bf070f..67fb82a40 100644
--- a/internal/gitaly/service/operations/commit_files_test.go
+++ b/internal/gitaly/service/operations/commit_files_test.go
@@ -17,7 +17,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
- "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -919,7 +918,7 @@ func TestUserCommitFiles(t *testing.T) {
}
resp, err := stream.CloseAndRecv()
- testassert.GrpcEqualErr(t, step.error, err)
+ testhelper.GrpcEqualErr(t, step.error, err)
if step.error != nil {
continue
}
diff --git a/internal/gitaly/service/operations/merge_test.go b/internal/gitaly/service/operations/merge_test.go
index 9c4af0cce..889d29b59 100644
--- a/internal/gitaly/service/operations/merge_test.go
+++ b/internal/gitaly/service/operations/merge_test.go
@@ -25,7 +25,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
- "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
@@ -97,7 +96,7 @@ func testUserMergeBranchSuccessful(t *testing.T, ctx context.Context) {
commit, err := repo.ReadCommit(ctx, git.Revision(mergeBranchName))
require.NoError(t, err, "look up git commit after call has finished")
- testassert.ProtoEqual(t, &gitalypb.OperationBranchUpdate{CommitId: commit.Id}, secondResponse.BranchUpdate)
+ testhelper.ProtoEqual(t, &gitalypb.OperationBranchUpdate{CommitId: commit.Id}, secondResponse.BranchUpdate)
require.Equal(t, commit.ParentIds, []string{mergeBranchHeadBefore, commitToMerge})
@@ -155,11 +154,11 @@ func testUserMergeBranchQuarantine(t *testing.T, ctx context.Context) {
require.NoError(t, stream.Send(&gitalypb.UserMergeBranchRequest{Apply: true}), "apply merge")
secondResponse, err := stream.Recv()
if featureflag.UserMergeBranchAccessError.IsEnabled(ctx) {
- testassert.GrpcEqualErr(t, helper.ErrInternalf("%s\n", firstResponse.CommitId), err)
+ testhelper.GrpcEqualErr(t, helper.ErrInternalf("%s\n", firstResponse.CommitId), err)
require.Nil(t, secondResponse)
} else {
require.NoError(t, err, "receive second response")
- testassert.ProtoEqual(t, &gitalypb.UserMergeBranchResponse{
+ testhelper.ProtoEqual(t, &gitalypb.UserMergeBranchResponse{
PreReceiveError: firstResponse.CommitId + "\n",
}, secondResponse)
}
@@ -344,11 +343,11 @@ func testUserMergeBranchConcurrentUpdate(t *testing.T, ctx context.Context) {
secondResponse, err := mergeBidi.Recv()
if featureflag.UserMergeBranchAccessError.IsEnabled(ctx) {
- testassert.GrpcEqualErr(t, helper.ErrFailedPreconditionf("Could not update refs/heads/gitaly-merge-test-branch. Please refresh and try again."), err)
+ testhelper.GrpcEqualErr(t, helper.ErrFailedPreconditionf("Could not update refs/heads/gitaly-merge-test-branch. Please refresh and try again."), err)
require.Nil(t, secondResponse)
} else {
require.NoError(t, err, "receive second response")
- testassert.ProtoEqual(t, secondResponse, &gitalypb.UserMergeBranchResponse{})
+ testhelper.ProtoEqual(t, secondResponse, &gitalypb.UserMergeBranchResponse{})
}
commit, err := repo.ReadCommit(ctx, git.Revision(mergeBranchName))
@@ -412,7 +411,7 @@ func testUserMergeBranchAmbiguousReference(t *testing.T, ctx context.Context) {
commit, err := repo.ReadCommit(ctx, git.Revision("refs/heads/"+mergeBranchName))
require.NoError(t, err, "look up git commit after call has finished")
- testassert.ProtoEqual(t, &gitalypb.OperationBranchUpdate{CommitId: commit.Id}, response.BranchUpdate)
+ testhelper.ProtoEqual(t, &gitalypb.OperationBranchUpdate{CommitId: commit.Id}, response.BranchUpdate)
require.Equal(t, mergeCommitMessage, string(commit.Body))
require.Equal(t, gittest.TestUser.Name, commit.Author.Name)
require.Equal(t, gittest.TestUser.Email, commit.Author.Email)
@@ -457,7 +456,7 @@ func testUserMergeBranchFailingHooks(t *testing.T, ctx context.Context) {
secondResponse, err := mergeBidi.Recv()
if featureflag.UserMergeBranchAccessError.IsEnabled(ctx) {
- testassert.GrpcEqualErr(t, helper.ErrInternalf("failure\n"), err)
+ testhelper.GrpcEqualErr(t, helper.ErrInternalf("failure\n"), err)
require.Nil(t, secondResponse)
} else {
require.NoError(t, err, "receive second response")
@@ -511,7 +510,7 @@ func testUserMergeBranchConflict(t *testing.T, ctx context.Context) {
}), "send first request")
firstResponse, err := mergeBidi.Recv()
- testassert.GrpcEqualErr(t, helper.ErrFailedPreconditionf("Failed to merge for source_sha %s into target_sha %s", divergedFrom, divergedInto), err)
+ testhelper.GrpcEqualErr(t, helper.ErrFailedPreconditionf("Failed to merge for source_sha %s into target_sha %s", divergedFrom, divergedInto), err)
require.Nil(t, firstResponse)
}
@@ -623,7 +622,7 @@ func testUserMergeBranchAllowed(t *testing.T, ctx context.Context) {
response, err := stream.Recv()
require.NoError(t, err)
- testassert.ProtoEqual(t, &gitalypb.UserMergeBranchResponse{
+ testhelper.ProtoEqual(t, &gitalypb.UserMergeBranchResponse{
CommitId: mergeBranchHeadAfter,
}, response)
@@ -633,11 +632,11 @@ func testUserMergeBranchAllowed(t *testing.T, ctx context.Context) {
response, err = stream.Recv()
if featureflag.UserMergeBranchAccessError.IsEnabled(ctx) {
- testassert.GrpcEqualErr(t, tc.expectedErr, err)
- testassert.ProtoEqual(t, tc.expectedResponse, response)
+ testhelper.GrpcEqualErr(t, tc.expectedErr, err)
+ testhelper.ProtoEqual(t, tc.expectedResponse, response)
} else {
require.NoError(t, err)
- testassert.ProtoEqual(t, tc.expectedResponseWithoutFF, response)
+ testhelper.ProtoEqual(t, tc.expectedResponseWithoutFF, response)
}
if err == nil {
@@ -682,7 +681,7 @@ func TestUserFFBranch_successful(t *testing.T) {
resp, err := client.UserFFBranch(ctx, request)
require.NoError(t, err)
- testassert.ProtoEqual(t, expectedResponse, resp)
+ testhelper.ProtoEqual(t, expectedResponse, resp)
newBranchHead := gittest.Exec(t, cfg, "-C", repoPath, "rev-parse", branchName)
require.Equal(t, commitID, text.ChompBytes(newBranchHead), "branch head not updated")
}
@@ -849,7 +848,7 @@ func TestUserFFBranch_ambiguousReference(t *testing.T) {
resp, err := client.UserFFBranch(ctx, request)
require.NoError(t, err)
- testassert.ProtoEqual(t, expectedResponse, resp)
+ testhelper.ProtoEqual(t, expectedResponse, resp)
newBranchHead := gittest.Exec(t, cfg, "-C", repoPath, "rev-parse", "refs/heads/"+branchName)
require.Equal(t, commitID, text.ChompBytes(newBranchHead), "branch head not updated")
}
@@ -1068,7 +1067,7 @@ func TestUserMergeToRef_conflicts(t *testing.T) {
request.AllowConflicts = false
_, err := client.UserMergeToRef(ctx, request)
- testassert.GrpcEqualErr(t, status.Error(codes.FailedPrecondition, "Failed to create merge commit for source_sha 1450cd639e0bc6721eb02800169e464f212cde06 and target_sha 824be604a34828eb682305f0d963056cfac87b2d at refs/merge-requests/x/written"), err)
+ testhelper.GrpcEqualErr(t, status.Error(codes.FailedPrecondition, "Failed to create merge commit for source_sha 1450cd639e0bc6721eb02800169e464f212cde06 and target_sha 824be604a34828eb682305f0d963056cfac87b2d at refs/merge-requests/x/written"), err)
})
targetRef := git.Revision("refs/merge-requests/foo")
@@ -1125,7 +1124,7 @@ func TestUserMergeToRef_stableMergeID(t *testing.T) {
commit, err := repo.ReadCommit(ctx, git.Revision("refs/merge-requests/x/written"))
require.NoError(t, err, "look up git commit after call has finished")
- testassert.ProtoEqual(t, &gitalypb.GitCommit{
+ testhelper.ProtoEqual(t, &gitalypb.GitCommit{
Subject: []byte("Merge message"),
Body: []byte("Merge message"),
BodySize: 13,
diff --git a/internal/gitaly/service/operations/rebase_test.go b/internal/gitaly/service/operations/rebase_test.go
index 6d6221649..fd040e9bc 100644
--- a/internal/gitaly/service/operations/rebase_test.go
+++ b/internal/gitaly/service/operations/rebase_test.go
@@ -16,7 +16,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/transaction"
"gitlab.com/gitlab-org/gitaly/v14/internal/metadata"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
- "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver"
"gitlab.com/gitlab-org/gitaly/v14/internal/transaction/txinfo"
"gitlab.com/gitlab-org/gitaly/v14/internal/transaction/voting"
@@ -232,7 +231,7 @@ func TestUserRebaseConfirmableStableCommitIDs(t *testing.T) {
commit, err := repo.ReadCommit(ctx, git.Revision(rebaseBranchName))
require.NoError(t, err, "look up git commit")
- testassert.ProtoEqual(t, &gitalypb.GitCommit{
+ testhelper.ProtoEqual(t, &gitalypb.GitCommit{
Subject: []byte("Add a directory with many files to allow testing of default 1,000 entry limit"),
Body: []byte("Add a directory with many files to allow testing of default 1,000 entry limit\n\nFor performance reasons, GitLab will add a file viewer limit and only show\nthe first 1,000 entries in a directory. Having this directory with many\nempty files in the test project will make the test easy.\n"),
BodySize: 283,
diff --git a/internal/gitaly/service/operations/squash_test.go b/internal/gitaly/service/operations/squash_test.go
index bba554088..4feeee756 100644
--- a/internal/gitaly/service/operations/squash_test.go
+++ b/internal/gitaly/service/operations/squash_test.go
@@ -15,7 +15,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/helper"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
- "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
"google.golang.org/protobuf/types/known/timestamppb"
@@ -391,7 +390,7 @@ func TestUserSquash_emptyCommit(t *testing.T) {
Timestamp: &timestamppb.Timestamp{Seconds: 1234512345},
})
require.NoError(t, err)
- testassert.ProtoEqual(t, &gitalypb.UserSquashResponse{
+ testhelper.ProtoEqual(t, &gitalypb.UserSquashResponse{
SquashSha: tc.expectedOID.String(),
}, response)
@@ -533,7 +532,7 @@ func TestUserSquash_conflicts(t *testing.T) {
})
require.NoError(t, err)
- testassert.ProtoEqual(t, &gitalypb.UserSquashResponse{
+ testhelper.ProtoEqual(t, &gitalypb.UserSquashResponse{
GitError: fmt.Sprintf("rebase: commit %q: conflicts have not been resolved", ours),
}, response)
}
@@ -569,7 +568,7 @@ func TestUserSquash_ancestry(t *testing.T) {
})
require.Nil(t, err)
- testassert.ProtoEqual(t, &gitalypb.UserSquashResponse{
+ testhelper.ProtoEqual(t, &gitalypb.UserSquashResponse{
SquashSha: "b277ddc0aafcba53f23f3d4d4a46dde42c9e7ad2",
}, response)
}
@@ -644,8 +643,8 @@ func TestUserSquash_gitError(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
response, err := client.UserSquash(ctx, tc.request)
- testassert.GrpcEqualErr(t, tc.expectedErr, err)
- testassert.ProtoEqual(t, tc.expectedResponse, response)
+ testhelper.GrpcEqualErr(t, tc.expectedErr, err)
+ testhelper.ProtoEqual(t, tc.expectedResponse, response)
})
}
}
diff --git a/internal/gitaly/service/operations/tags_test.go b/internal/gitaly/service/operations/tags_test.go
index fd860743f..bb6cd94b0 100644
--- a/internal/gitaly/service/operations/tags_test.go
+++ b/internal/gitaly/service/operations/tags_test.go
@@ -18,7 +18,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/v14/internal/metadata"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
- "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver"
"gitlab.com/gitlab-org/gitaly/v14/internal/transaction/txinfo"
@@ -241,7 +240,7 @@ func TestSuccessfulUserCreateTagRequest(t *testing.T) {
responseOk.Tag.Id = text.ChompBytes(id)
}
- testassert.ProtoEqual(t, responseOk, response)
+ testhelper.ProtoEqual(t, responseOk, response)
tag := gittest.Exec(t, cfg, "-C", repoPath, "tag")
require.Contains(t, string(tag), inputTagName)
@@ -371,7 +370,7 @@ func TestUserCreateTagWithTransaction(t *testing.T) {
}
require.Equal(t, targetOIDOK, targetRevision)
- testassert.ProtoEqual(t, &gitalypb.UserCreateTagResponse{
+ testhelper.ProtoEqual(t, &gitalypb.UserCreateTagResponse{
Tag: &gitalypb.Tag{
Name: []byte(tagName),
Message: []byte(testCase.message),
@@ -428,7 +427,7 @@ func TestUserCreateTagQuarantine(t *testing.T) {
// Conveniently, the pre-receive error will now contain output from our custom hook and thus
// the tag's contents.
- testassert.ProtoEqual(t, &gitalypb.UserCreateTagResponse{
+ testhelper.ProtoEqual(t, &gitalypb.UserCreateTagResponse{
PreReceiveError: `object c7fbe50c7c7419d9701eebe64b1fdacc3df5b9dd
type commit
tag quarantined-tag
@@ -525,7 +524,7 @@ func TestSuccessfulUserCreateTagRequestAnnotatedLightweightDisambiguation(t *tes
response, err := client.UserCreateTag(ctx, request)
if testCase.err != nil {
- testassert.GrpcEqualErr(t, testCase.err, err)
+ testhelper.GrpcEqualErr(t, testCase.err, err)
} else {
defer gittest.Exec(t, cfg, "-C", repoPath, "tag", "-d", tagName)
require.NoError(t, err)
@@ -717,7 +716,7 @@ func TestSuccessfulUserCreateTagRequestToNonCommit(t *testing.T) {
tagID := gittest.Exec(t, cfg, "-C", repoPath, "rev-parse", inputTagName)
responseOk.Tag.Id = text.ChompBytes(tagID)
}
- testassert.ProtoEqual(t, responseOk, response)
+ testhelper.ProtoEqual(t, responseOk, response)
peeledID := gittest.Exec(t, cfg, "-C", repoPath, "rev-parse", inputTagName+"^{}")
require.Equal(t, testCase.targetRevision, text.ChompBytes(peeledID))
@@ -810,7 +809,7 @@ func TestSuccessfulUserCreateTagNestedTags(t *testing.T) {
responseOk.Tag.TargetCommit, err = repo.ReadCommit(ctx, git.Revision(testCase.targetObject))
require.NoError(t, err)
}
- testassert.ProtoEqual(t, responseOk, response)
+ testhelper.ProtoEqual(t, responseOk, response)
peeledID := gittest.Exec(t, cfg, "-C", repoPath, "rev-parse", tagName+"^{}")
peeledIDStr := text.ChompBytes(peeledID)
@@ -845,7 +844,7 @@ func TestSuccessfulUserCreateTagNestedTags(t *testing.T) {
MessageSize: 0,
},
}
- testassert.ProtoEqual(t, responseOk, response)
+ testhelper.ProtoEqual(t, responseOk, response)
createdIDLight := gittest.Exec(t, cfg, "-C", repoPath, "rev-parse", tagNameLight)
createdIDLightStr := text.ChompBytes(createdIDLight)
@@ -917,8 +916,8 @@ func TestUserDeleteTagSuccessfulDeletionOfPrefixedTag(t *testing.T) {
}
response, err := client.UserDeleteTag(ctx, request)
- testassert.GrpcEqualErr(t, testCase.err, err)
- testassert.ProtoEqual(t, testCase.response, response)
+ testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.ProtoEqual(t, testCase.response, response)
refs := gittest.Exec(t, cfg, "-C", repoPath, "for-each-ref", "--", "refs/tags/"+testCase.tagNameInput)
require.NotContains(t, string(refs), testCase.tagCommit, "tag kept because we stripped off refs/tags/*")
@@ -963,7 +962,7 @@ func TestUserCreateTagsuccessfulCreationOfPrefixedTag(t *testing.T) {
}
response, err := client.UserCreateTag(ctx, request)
- testassert.GrpcEqualErr(t, testCase.err, err)
+ testhelper.GrpcEqualErr(t, testCase.err, err)
commitOk, err := repo.ReadCommit(ctx, git.Revision(testCase.tagTargetRevisionInput))
require.NoError(t, err)
@@ -975,7 +974,7 @@ func TestUserCreateTagsuccessfulCreationOfPrefixedTag(t *testing.T) {
},
}
- testassert.ProtoEqual(t, responseOk, response)
+ testhelper.ProtoEqual(t, responseOk, response)
refs := gittest.Exec(t, cfg, "-C", repoPath, "for-each-ref", "--", "refs/tags/"+testCase.tagNameInput)
require.Contains(t, string(refs), testCase.tagTargetRevisionInput, "tag created, we did not strip off refs/tags/*")
@@ -1085,8 +1084,8 @@ func TestFailedUserDeleteTagRequestDueToValidation(t *testing.T) {
for _, testCase := range testCases {
t.Run(testCase.desc, func(t *testing.T) {
response, err := client.UserDeleteTag(ctx, testCase.request)
- testassert.GrpcEqualErr(t, testCase.err, err)
- testassert.ProtoEqual(t, testCase.response, response)
+ testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.ProtoEqual(t, testCase.response, response)
})
}
}
@@ -1196,8 +1195,8 @@ func TestFailedUserCreateTagRequestDueToTagExistence(t *testing.T) {
}
response, err := client.UserCreateTag(ctx, request)
- testassert.GrpcEqualErr(t, testCase.err, err)
- testassert.ProtoEqual(t, testCase.response, response)
+ testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.ProtoEqual(t, testCase.response, response)
})
}
}
@@ -1315,8 +1314,8 @@ func TestFailedUserCreateTagRequestDueToValidation(t *testing.T) {
}
response, err := client.UserCreateTag(ctx, request)
- testassert.GrpcEqualErr(t, testCase.err, err)
- testassert.ProtoEqual(t, testCase.response, response)
+ testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.ProtoEqual(t, testCase.response, response)
})
}
}
@@ -1395,7 +1394,7 @@ func TestTagHookOutput(t *testing.T) {
Exists: false,
PreReceiveError: expectedError,
}
- testassert.ProtoEqual(t, createResponseOk, createResponse)
+ testhelper.ProtoEqual(t, createResponseOk, createResponse)
defer gittest.Exec(t, cfg, "-C", repoPath, "tag", "-d", tagNameInput)
gittest.Exec(t, cfg, "-C", repoPath, "tag", tagNameInput)
@@ -1405,7 +1404,7 @@ func TestTagHookOutput(t *testing.T) {
deleteResponseOk := &gitalypb.UserDeleteTagResponse{
PreReceiveError: expectedError,
}
- testassert.ProtoEqual(t, deleteResponseOk, deleteResponse)
+ testhelper.ProtoEqual(t, deleteResponseOk, deleteResponse)
})
}
}
diff --git a/internal/gitaly/service/operations/update_branches_test.go b/internal/gitaly/service/operations/update_branches_test.go
index 72bc5bd4c..a090f2e1f 100644
--- a/internal/gitaly/service/operations/update_branches_test.go
+++ b/internal/gitaly/service/operations/update_branches_test.go
@@ -10,7 +10,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
- "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -86,7 +85,7 @@ func TestSuccessfulUserUpdateBranchRequest(t *testing.T) {
}
response, err := client.UserUpdateBranch(ctx, request)
require.NoError(t, err)
- testassert.ProtoEqual(t, responseOk, response)
+ testhelper.ProtoEqual(t, responseOk, response)
branchCommit, err := repo.ReadCommit(ctx, git.Revision(testCase.updateBranchName))
@@ -159,7 +158,7 @@ func TestSuccessfulUserUpdateBranchRequestToDelete(t *testing.T) {
}
response, err := client.UserUpdateBranch(ctx, request)
require.NoError(t, err)
- testassert.ProtoEqual(t, responseOk, response)
+ testhelper.ProtoEqual(t, responseOk, response)
_, err = repo.ReadCommit(ctx, git.Revision(testCase.updateBranchName))
require.Equal(t, localrepo.ErrObjectNotFound, err, "expected 'not found' error got %v", err)
@@ -197,7 +196,7 @@ func TestSuccessfulGitHooksForUserUpdateBranchRequest(t *testing.T) {
require.NoError(t, err)
require.Empty(t, response.PreReceiveError)
- testassert.ProtoEqual(t, responseOk, response)
+ testhelper.ProtoEqual(t, responseOk, response)
output := string(testhelper.MustReadFile(t, hookOutputTempPath))
require.Contains(t, output, "GL_USERNAME="+gittest.TestUser.GlUsername)
})
@@ -234,7 +233,7 @@ func TestFailedUserUpdateBranchDueToHooks(t *testing.T) {
responseOk := &gitalypb.UserUpdateBranchResponse{
PreReceiveError: response.PreReceiveError,
}
- testassert.ProtoEqual(t, responseOk, response)
+ testhelper.ProtoEqual(t, responseOk, response)
}
}
@@ -368,8 +367,8 @@ func TestFailedUserUpdateBranchRequest(t *testing.T) {
}
response, err := client.UserUpdateBranch(ctx, request)
- testassert.ProtoEqual(t, testCase.response, response)
- testassert.GrpcEqualErr(t, testCase.err, err)
+ testhelper.ProtoEqual(t, testCase.response, response)
+ testhelper.GrpcEqualErr(t, testCase.err, err)
branchCommit, err := repo.ReadCommit(ctx, git.Revision(testCase.branchName))
if testCase.expectNotFoundError {