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:50:54 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-12-06 09:50:54 +0300
commit4cacba036ead2988678c861d741f6110a15be551 (patch)
treee528caa53c70b99e0364a685821062abd348fee9 /internal/gitaly/service/operations
parent575d77c93d929d80401851c0e587a2f8c2212797 (diff)
testhelper: Rename `GrpcEqualErr()` to `RequireGrpcError()`
The naming of the `GrpcEqualErr()` helper function is quite irregular compared to other helper functions we have. Most importantly, it's significantly different from `RequireGrpcCode()` and may thus be easy to miss. Rename it to `RequireGrpcError()` to clarify this.
Diffstat (limited to 'internal/gitaly/service/operations')
-rw-r--r--internal/gitaly/service/operations/apply_patch_test.go2
-rw-r--r--internal/gitaly/service/operations/branches_test.go4
-rw-r--r--internal/gitaly/service/operations/commit_files_test.go2
-rw-r--r--internal/gitaly/service/operations/merge_test.go12
-rw-r--r--internal/gitaly/service/operations/squash_test.go2
-rw-r--r--internal/gitaly/service/operations/tags_test.go12
-rw-r--r--internal/gitaly/service/operations/update_branches_test.go2
7 files changed, 18 insertions, 18 deletions
diff --git a/internal/gitaly/service/operations/apply_patch_test.go b/internal/gitaly/service/operations/apply_patch_test.go
index c4a1d6931..89b50f4f0 100644
--- a/internal/gitaly/service/operations/apply_patch_test.go
+++ b/internal/gitaly/service/operations/apply_patch_test.go
@@ -388,7 +388,7 @@ To restore the original branch and stop patching, run "git am --abort".
actualResponse, err := stream.CloseAndRecv()
if tc.error != nil {
- testhelper.GrpcEqualErr(t, tc.error, err)
+ testhelper.RequireGrpcError(t, tc.error, err)
return
}
diff --git a/internal/gitaly/service/operations/branches_test.go b/internal/gitaly/service/operations/branches_test.go
index 57bd8bd81..8604987c5 100644
--- a/internal/gitaly/service/operations/branches_test.go
+++ b/internal/gitaly/service/operations/branches_test.go
@@ -379,7 +379,7 @@ func TestFailedUserCreateBranchRequest(t *testing.T) {
}
response, err := client.UserCreateBranch(ctx, request)
- testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.RequireGrpcError(t, testCase.err, err)
require.Empty(t, response)
})
}
@@ -571,7 +571,7 @@ func TestFailedUserDeleteBranchDueToValidation(t *testing.T) {
for _, testCase := range testCases {
t.Run(testCase.desc, func(t *testing.T) {
response, err := client.UserDeleteBranch(ctx, testCase.request)
- testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.RequireGrpcError(t, testCase.err, err)
testhelper.ProtoEqual(t, testCase.response, response)
})
}
diff --git a/internal/gitaly/service/operations/commit_files_test.go b/internal/gitaly/service/operations/commit_files_test.go
index f9207b3ba..40290b488 100644
--- a/internal/gitaly/service/operations/commit_files_test.go
+++ b/internal/gitaly/service/operations/commit_files_test.go
@@ -918,7 +918,7 @@ func TestUserCommitFiles(t *testing.T) {
}
resp, err := stream.CloseAndRecv()
- testhelper.GrpcEqualErr(t, step.error, err)
+ testhelper.RequireGrpcError(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 33971cc8a..bdb02fdb2 100644
--- a/internal/gitaly/service/operations/merge_test.go
+++ b/internal/gitaly/service/operations/merge_test.go
@@ -154,7 +154,7 @@ 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) {
- testhelper.GrpcEqualErr(t, helper.ErrInternalf("%s\n", firstResponse.CommitId), err)
+ testhelper.RequireGrpcError(t, helper.ErrInternalf("%s\n", firstResponse.CommitId), err)
require.Nil(t, secondResponse)
} else {
require.NoError(t, err, "receive second response")
@@ -343,7 +343,7 @@ func testUserMergeBranchConcurrentUpdate(t *testing.T, ctx context.Context) {
secondResponse, err := mergeBidi.Recv()
if featureflag.UserMergeBranchAccessError.IsEnabled(ctx) {
- testhelper.GrpcEqualErr(t, helper.ErrFailedPreconditionf("Could not update refs/heads/gitaly-merge-test-branch. Please refresh and try again."), err)
+ testhelper.RequireGrpcError(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")
@@ -456,7 +456,7 @@ func testUserMergeBranchFailingHooks(t *testing.T, ctx context.Context) {
secondResponse, err := mergeBidi.Recv()
if featureflag.UserMergeBranchAccessError.IsEnabled(ctx) {
- testhelper.GrpcEqualErr(t, helper.ErrInternalf("failure\n"), err)
+ testhelper.RequireGrpcError(t, helper.ErrInternalf("failure\n"), err)
require.Nil(t, secondResponse)
} else {
require.NoError(t, err, "receive second response")
@@ -510,7 +510,7 @@ func testUserMergeBranchConflict(t *testing.T, ctx context.Context) {
}), "send first request")
firstResponse, err := mergeBidi.Recv()
- testhelper.GrpcEqualErr(t, helper.ErrFailedPreconditionf("Failed to merge for source_sha %s into target_sha %s", divergedFrom, divergedInto), err)
+ testhelper.RequireGrpcError(t, helper.ErrFailedPreconditionf("Failed to merge for source_sha %s into target_sha %s", divergedFrom, divergedInto), err)
require.Nil(t, firstResponse)
}
@@ -632,7 +632,7 @@ func testUserMergeBranchAllowed(t *testing.T, ctx context.Context) {
response, err = stream.Recv()
if featureflag.UserMergeBranchAccessError.IsEnabled(ctx) {
- testhelper.GrpcEqualErr(t, tc.expectedErr, err)
+ testhelper.RequireGrpcError(t, tc.expectedErr, err)
testhelper.ProtoEqual(t, tc.expectedResponse, response)
} else {
require.NoError(t, err)
@@ -1067,7 +1067,7 @@ func TestUserMergeToRef_conflicts(t *testing.T) {
request.AllowConflicts = false
_, err := client.UserMergeToRef(ctx, request)
- 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)
+ testhelper.RequireGrpcError(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")
diff --git a/internal/gitaly/service/operations/squash_test.go b/internal/gitaly/service/operations/squash_test.go
index 355d45e8c..e836e0773 100644
--- a/internal/gitaly/service/operations/squash_test.go
+++ b/internal/gitaly/service/operations/squash_test.go
@@ -643,7 +643,7 @@ 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)
- testhelper.GrpcEqualErr(t, tc.expectedErr, err)
+ testhelper.RequireGrpcError(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 bb6cd94b0..a01b8b448 100644
--- a/internal/gitaly/service/operations/tags_test.go
+++ b/internal/gitaly/service/operations/tags_test.go
@@ -524,7 +524,7 @@ func TestSuccessfulUserCreateTagRequestAnnotatedLightweightDisambiguation(t *tes
response, err := client.UserCreateTag(ctx, request)
if testCase.err != nil {
- testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.RequireGrpcError(t, testCase.err, err)
} else {
defer gittest.Exec(t, cfg, "-C", repoPath, "tag", "-d", tagName)
require.NoError(t, err)
@@ -916,7 +916,7 @@ func TestUserDeleteTagSuccessfulDeletionOfPrefixedTag(t *testing.T) {
}
response, err := client.UserDeleteTag(ctx, request)
- testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.RequireGrpcError(t, testCase.err, err)
testhelper.ProtoEqual(t, testCase.response, response)
refs := gittest.Exec(t, cfg, "-C", repoPath, "for-each-ref", "--", "refs/tags/"+testCase.tagNameInput)
@@ -962,7 +962,7 @@ func TestUserCreateTagsuccessfulCreationOfPrefixedTag(t *testing.T) {
}
response, err := client.UserCreateTag(ctx, request)
- testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.RequireGrpcError(t, testCase.err, err)
commitOk, err := repo.ReadCommit(ctx, git.Revision(testCase.tagTargetRevisionInput))
require.NoError(t, err)
@@ -1084,7 +1084,7 @@ func TestFailedUserDeleteTagRequestDueToValidation(t *testing.T) {
for _, testCase := range testCases {
t.Run(testCase.desc, func(t *testing.T) {
response, err := client.UserDeleteTag(ctx, testCase.request)
- testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.RequireGrpcError(t, testCase.err, err)
testhelper.ProtoEqual(t, testCase.response, response)
})
}
@@ -1195,7 +1195,7 @@ func TestFailedUserCreateTagRequestDueToTagExistence(t *testing.T) {
}
response, err := client.UserCreateTag(ctx, request)
- testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.RequireGrpcError(t, testCase.err, err)
testhelper.ProtoEqual(t, testCase.response, response)
})
}
@@ -1314,7 +1314,7 @@ func TestFailedUserCreateTagRequestDueToValidation(t *testing.T) {
}
response, err := client.UserCreateTag(ctx, request)
- testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.RequireGrpcError(t, testCase.err, err)
testhelper.ProtoEqual(t, testCase.response, response)
})
}
diff --git a/internal/gitaly/service/operations/update_branches_test.go b/internal/gitaly/service/operations/update_branches_test.go
index a090f2e1f..184783e32 100644
--- a/internal/gitaly/service/operations/update_branches_test.go
+++ b/internal/gitaly/service/operations/update_branches_test.go
@@ -368,7 +368,7 @@ func TestFailedUserUpdateBranchRequest(t *testing.T) {
response, err := client.UserUpdateBranch(ctx, request)
testhelper.ProtoEqual(t, testCase.response, response)
- testhelper.GrpcEqualErr(t, testCase.err, err)
+ testhelper.RequireGrpcError(t, testCase.err, err)
branchCommit, err := repo.ReadCommit(ctx, git.Revision(testCase.branchName))
if testCase.expectNotFoundError {