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:
authorJacob Vosmaer <jacob@gitlab.com>2018-05-29 18:08:44 +0300
committerJacob Vosmaer <jacob@gitlab.com>2018-05-29 18:08:44 +0300
commita6b1b708b65df43d76c56ff08de09e6b3f25677d (patch)
treeb84ab92b013742ddbd34334fd3c568431f4c096d
parent273532e2e48cff5aa702463345e17211a2ea0f40 (diff)
Don't match text in grpc errorsgrpc-error-dont-match-text
-rw-r--r--internal/helper/repo_test.go4
-rw-r--r--internal/rubyserver/rubyserver_test.go2
-rw-r--r--internal/server/auth_test.go2
-rw-r--r--internal/service/blob/get_blobs_test.go2
-rw-r--r--internal/service/blob/lfs_pointers_test.go6
-rw-r--r--internal/service/commit/between_test.go2
-rw-r--r--internal/service/commit/commit_messages_test.go2
-rw-r--r--internal/service/commit/commit_signatures_test.go2
-rw-r--r--internal/service/commit/commits_by_message_test.go2
-rw-r--r--internal/service/commit/count_commits_test.go2
-rw-r--r--internal/service/commit/extractsignature_test.go2
-rw-r--r--internal/service/commit/filter_shas_with_signatures_test.go2
-rw-r--r--internal/service/commit/find_all_commits_test.go2
-rw-r--r--internal/service/commit/find_commit_test.go2
-rw-r--r--internal/service/commit/find_commits_test.go2
-rw-r--r--internal/service/commit/last_commit_for_path_test.go2
-rw-r--r--internal/service/commit/list_files_test.go2
-rw-r--r--internal/service/commit/raw_blame_test.go2
-rw-r--r--internal/service/commit/stats_test.go2
-rw-r--r--internal/service/commit/tree_entries_test.go2
-rw-r--r--internal/service/commit/tree_entry_test.go2
-rw-r--r--internal/service/conflicts/list_conflict_files_test.go4
-rw-r--r--internal/service/conflicts/resolve_conflicts_test.go2
-rw-r--r--internal/service/diff/commit_test.go8
-rw-r--r--internal/service/diff/raw_test.go4
-rw-r--r--internal/service/notifications/post_receive_test.go2
-rw-r--r--internal/service/operations/branches_test.go4
-rw-r--r--internal/service/operations/cherry_pick_test.go2
-rw-r--r--internal/service/operations/commit_files_test.go2
-rw-r--r--internal/service/operations/merge_test.go2
-rw-r--r--internal/service/operations/rebase_test.go2
-rw-r--r--internal/service/operations/revert_test.go2
-rw-r--r--internal/service/operations/squash_test.go2
-rw-r--r--internal/service/operations/tags_test.go4
-rw-r--r--internal/service/ref/branches_test.go4
-rw-r--r--internal/service/ref/delete_refs_test.go2
-rw-r--r--internal/service/ref/refs_test.go8
-rw-r--r--internal/service/ref/tag_messages_test.go2
-rw-r--r--internal/service/remote/fetch_internal_remote_test.go2
-rw-r--r--internal/service/remote/remotes_test.go6
-rw-r--r--internal/service/remote/update_remote_mirror_test.go2
-rw-r--r--internal/service/repository/apply_gitattributes_test.go2
-rw-r--r--internal/service/repository/archive_test.go2
-rw-r--r--internal/service/repository/calculate_checksum_test.go4
-rw-r--r--internal/service/repository/create_bundle_test.go2
-rw-r--r--internal/service/repository/create_from_bundle_test.go2
-rw-r--r--internal/service/repository/create_from_snapshot_test.go10
-rw-r--r--internal/service/repository/create_from_url_test.go2
-rw-r--r--internal/service/repository/create_test.go4
-rw-r--r--internal/service/repository/fetch_remote_test.go2
-rw-r--r--internal/service/repository/fetch_test.go2
-rw-r--r--internal/service/repository/fork_test.go2
-rw-r--r--internal/service/repository/gc_test.go4
-rw-r--r--internal/service/repository/merge_base_test.go2
-rw-r--r--internal/service/repository/raw_changes_test.go2
-rw-r--r--internal/service/repository/rebase_in_progress_test.go2
-rw-r--r--internal/service/repository/repack_test.go4
-rw-r--r--internal/service/repository/search_files_test.go4
-rw-r--r--internal/service/repository/size_test.go2
-rw-r--r--internal/service/repository/snapshot_test.go4
-rw-r--r--internal/service/repository/squash_in_progress_test.go2
-rw-r--r--internal/service/repository/write_config_test.go2
-rw-r--r--internal/service/repository/write_ref_test.go2
-rw-r--r--internal/service/smarthttp/inforefs_test.go4
-rw-r--r--internal/service/smarthttp/receive_pack_test.go2
-rw-r--r--internal/service/smarthttp/upload_pack_test.go4
-rw-r--r--internal/service/ssh/receive_pack_test.go2
-rw-r--r--internal/service/ssh/upload_archive_test.go2
-rw-r--r--internal/service/ssh/upload_pack_test.go2
-rw-r--r--internal/service/wiki/delete_page_test.go2
-rw-r--r--internal/service/wiki/find_file_test.go2
-rw-r--r--internal/service/wiki/find_page_test.go2
-rw-r--r--internal/service/wiki/formatted_data_test.go2
-rw-r--r--internal/service/wiki/get_all_pages_test.go2
-rw-r--r--internal/service/wiki/update_page_test.go2
-rw-r--r--internal/service/wiki/write_page_test.go2
-rw-r--r--internal/testhelper/testhelper.go8
77 files changed, 106 insertions, 110 deletions
diff --git a/internal/helper/repo_test.go b/internal/helper/repo_test.go
index 5bb307b2e..53188000e 100644
--- a/internal/helper/repo_test.go
+++ b/internal/helper/repo_test.go
@@ -126,7 +126,7 @@ func TestGetRepoPath(t *testing.T) {
path, err := GetRepoPath(tc.repo)
if tc.err != codes.OK {
- testhelper.AssertGrpcError(t, err, tc.err, "")
+ testhelper.RequireGrpcError(t, err, tc.err)
return
}
@@ -150,7 +150,7 @@ func assertInvalidRepoWithoutFile(t *testing.T, repo *pb.Repository, repoPath, f
_, err := GetRepoPath(repo)
- testhelper.AssertGrpcError(t, err, codes.NotFound, "")
+ testhelper.RequireGrpcError(t, err, codes.NotFound)
}
func TestGetRepoPathWithCorruptedRepo(t *testing.T) {
diff --git a/internal/rubyserver/rubyserver_test.go b/internal/rubyserver/rubyserver_test.go
index 5233d720c..bc0d100b5 100644
--- a/internal/rubyserver/rubyserver_test.go
+++ b/internal/rubyserver/rubyserver_test.go
@@ -76,7 +76,7 @@ func TestSetHeaders(t *testing.T) {
clientCtx, err := tc.setter(ctx, tc.repo)
if tc.errType != codes.OK {
- testhelper.AssertGrpcError(t, err, tc.errType, "")
+ testhelper.RequireGrpcError(t, err, tc.errType)
assert.Nil(t, clientCtx)
} else {
assert.NoError(t, err)
diff --git a/internal/server/auth_test.go b/internal/server/auth_test.go
index 968a01144..f2ca591b9 100644
--- a/internal/server/auth_test.go
+++ b/internal/server/auth_test.go
@@ -63,7 +63,7 @@ func TestAuthFailures(t *testing.T) {
conn, err := dial(serverSocketPath, connOpts)
require.NoError(t, err, tc.desc)
defer conn.Close()
- testhelper.AssertGrpcError(t, healthCheck(conn), tc.code, "")
+ testhelper.RequireGrpcError(t, healthCheck(conn), tc.code)
})
}
}
diff --git a/internal/service/blob/get_blobs_test.go b/internal/service/blob/get_blobs_test.go
index 6eb3bd26c..c678b3ab6 100644
--- a/internal/service/blob/get_blobs_test.go
+++ b/internal/service/blob/get_blobs_test.go
@@ -165,7 +165,7 @@ func TestFailedGetBlobsRequestDueToValidation(t *testing.T) {
_, err = stream.Recv()
require.NotEqual(t, io.EOF, err)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/blob/lfs_pointers_test.go b/internal/service/blob/lfs_pointers_test.go
index cd76e2d2c..d4fec0348 100644
--- a/internal/service/blob/lfs_pointers_test.go
+++ b/internal/service/blob/lfs_pointers_test.go
@@ -119,7 +119,7 @@ func TestFailedGetLFSPointersRequestDueToValidations(t *testing.T) {
_, err = stream.Recv()
require.NotEqual(t, io.EOF, err)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
@@ -304,7 +304,7 @@ func TestFailedGetNewLFSPointersRequestDueToValidations(t *testing.T) {
require.NoError(t, err)
err = drainNewPointers(c)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, tc.desc)
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
@@ -420,7 +420,7 @@ func TestFailedGetAllLFSPointersRequestDueToValidations(t *testing.T) {
require.NoError(t, err)
err = drainAllPointers(c)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, tc.desc)
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/commit/between_test.go b/internal/service/commit/between_test.go
index c9eb46f6a..8ebe09b4d 100644
--- a/internal/service/commit/between_test.go
+++ b/internal/service/commit/between_test.go
@@ -267,7 +267,7 @@ func TestFailedCommitsBetweenRequest(t *testing.T) {
}
err = drainCommitsBetweenResponse(c)
- testhelper.AssertGrpcError(t, err, tc.code, "")
+ testhelper.RequireGrpcError(t, err, tc.code)
})
}
}
diff --git a/internal/service/commit/commit_messages_test.go b/internal/service/commit/commit_messages_test.go
index 33a221e58..a9ce8b4b1 100644
--- a/internal/service/commit/commit_messages_test.go
+++ b/internal/service/commit/commit_messages_test.go
@@ -93,7 +93,7 @@ func TestFailedGetCommitMessagesRequest(t *testing.T) {
}
}
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/commit/commit_signatures_test.go b/internal/service/commit/commit_signatures_test.go
index 79f7b2d1c..026bbd3b6 100644
--- a/internal/service/commit/commit_signatures_test.go
+++ b/internal/service/commit/commit_signatures_test.go
@@ -103,7 +103,7 @@ func TestFailedGetCommitSignaturesRequest(t *testing.T) {
}
}
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/commit/commits_by_message_test.go b/internal/service/commit/commits_by_message_test.go
index f2990b47e..5f62a6cec 100644
--- a/internal/service/commit/commits_by_message_test.go
+++ b/internal/service/commit/commits_by_message_test.go
@@ -198,7 +198,7 @@ func TestFailedCommitsByMessageRequest(t *testing.T) {
t.Fatal(err)
}
- testhelper.AssertGrpcError(t, drainCommitsByMessageResponse(c), testCase.code, "")
+ testhelper.RequireGrpcError(t, drainCommitsByMessageResponse(c), testCase.code)
})
}
}
diff --git a/internal/service/commit/count_commits_test.go b/internal/service/commit/count_commits_test.go
index 64a4b40c1..33ae04c22 100644
--- a/internal/service/commit/count_commits_test.go
+++ b/internal/service/commit/count_commits_test.go
@@ -189,7 +189,7 @@ func TestFailedCountCommitsRequestDueToValidationError(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_, err := client.CountCommits(ctx, &rpcRequest)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/commit/extractsignature_test.go b/internal/service/commit/extractsignature_test.go
index 3620cce67..81b464456 100644
--- a/internal/service/commit/extractsignature_test.go
+++ b/internal/service/commit/extractsignature_test.go
@@ -158,7 +158,7 @@ func TestExtractCommitSignatureFail(t *testing.T) {
if tc.code == codes.OK {
require.Equal(t, io.EOF, err, "expect EOF when there is no error")
} else {
- testhelper.AssertGrpcError(t, err, tc.code, "")
+ testhelper.RequireGrpcError(t, err, tc.code)
}
})
}
diff --git a/internal/service/commit/filter_shas_with_signatures_test.go b/internal/service/commit/filter_shas_with_signatures_test.go
index 1e57d7092..06eccc1e1 100644
--- a/internal/service/commit/filter_shas_with_signatures_test.go
+++ b/internal/service/commit/filter_shas_with_signatures_test.go
@@ -82,7 +82,7 @@ func TestFilterShasWithSignaturesValidationError(t *testing.T) {
require.NoError(t, stream.CloseSend())
_, err = recvFSWS(stream)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "no repo")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
}
func recvFSWS(stream pb.CommitService_FilterShasWithSignaturesClient) ([][]byte, error) {
diff --git a/internal/service/commit/find_all_commits_test.go b/internal/service/commit/find_all_commits_test.go
index 6d40feb68..24a255cea 100644
--- a/internal/service/commit/find_all_commits_test.go
+++ b/internal/service/commit/find_all_commits_test.go
@@ -322,7 +322,7 @@ func TestFailedFindAllCommitsRequest(t *testing.T) {
}
err = drainFindAllCommitsResponse(c)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/commit/find_commit_test.go b/internal/service/commit/find_commit_test.go
index ab5b8d0a8..cb7694f82 100644
--- a/internal/service/commit/find_commit_test.go
+++ b/internal/service/commit/find_commit_test.go
@@ -257,7 +257,7 @@ func TestFailedFindCommitRequest(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_, err := client.FindCommit(ctx, request)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/commit/find_commits_test.go b/internal/service/commit/find_commits_test.go
index b72f81d5d..2fdca1020 100644
--- a/internal/service/commit/find_commits_test.go
+++ b/internal/service/commit/find_commits_test.go
@@ -386,7 +386,7 @@ func TestFailureFindCommitsRequest(t *testing.T) {
_, err = stream.Recv()
}
- testhelper.AssertGrpcError(t, err, tc.code, "")
+ testhelper.RequireGrpcError(t, err, tc.code)
})
}
}
diff --git a/internal/service/commit/last_commit_for_path_test.go b/internal/service/commit/last_commit_for_path_test.go
index ffc5874b5..58e234d73 100644
--- a/internal/service/commit/last_commit_for_path_test.go
+++ b/internal/service/commit/last_commit_for_path_test.go
@@ -131,7 +131,7 @@ func TestFailedLastCommitForPathRequest(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_, err := client.LastCommitForPath(ctx, testCase.request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/commit/list_files_test.go b/internal/service/commit/list_files_test.go
index dea1ae6b5..acd93e609 100644
--- a/internal/service/commit/list_files_test.go
+++ b/internal/service/commit/list_files_test.go
@@ -171,7 +171,7 @@ func TestListFilesFailure(t *testing.T) {
}
err = drainListFilesResponse(c)
- testhelper.AssertGrpcError(t, err, test.code, "")
+ testhelper.RequireGrpcError(t, err, test.code)
})
}
}
diff --git a/internal/service/commit/raw_blame_test.go b/internal/service/commit/raw_blame_test.go
index 2b633d519..aa3d3c39d 100644
--- a/internal/service/commit/raw_blame_test.go
+++ b/internal/service/commit/raw_blame_test.go
@@ -133,7 +133,7 @@ func TestFailedRawBlameRequest(t *testing.T) {
t.Fatal(err)
}
- testhelper.AssertGrpcError(t, drainRawBlameResponse(c), testCase.code, "")
+ testhelper.RequireGrpcError(t, drainRawBlameResponse(c), testCase.code)
})
}
}
diff --git a/internal/service/commit/stats_test.go b/internal/service/commit/stats_test.go
index 0c425c85f..bf0d7e34a 100644
--- a/internal/service/commit/stats_test.go
+++ b/internal/service/commit/stats_test.go
@@ -95,7 +95,7 @@ func TestCommitStatsFailure(t *testing.T) {
for _, tc := range tests {
t.Run(tc.desc, func(t *testing.T) {
_, err := client.CommitStats(ctx, &pb.CommitStatsRequest{Repository: tc.repo, Revision: tc.revision})
- testhelper.AssertGrpcError(t, err, tc.err, "")
+ testhelper.RequireGrpcError(t, err, tc.err)
})
}
}
diff --git a/internal/service/commit/tree_entries_test.go b/internal/service/commit/tree_entries_test.go
index 8158291f5..209603cd7 100644
--- a/internal/service/commit/tree_entries_test.go
+++ b/internal/service/commit/tree_entries_test.go
@@ -377,7 +377,7 @@ func TestFailedGetTreeEntriesRequestDueToValidationError(t *testing.T) {
}
err = drainTreeEntriesResponse(c)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/commit/tree_entry_test.go b/internal/service/commit/tree_entry_test.go
index ecf2159a9..4202b2aff 100644
--- a/internal/service/commit/tree_entry_test.go
+++ b/internal/service/commit/tree_entry_test.go
@@ -188,7 +188,7 @@ func TestFailedTreeEntryRequestDueToValidationError(t *testing.T) {
}
err = drainTreeEntryResponse(c)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/conflicts/list_conflict_files_test.go b/internal/service/conflicts/list_conflict_files_test.go
index e9013f7cf..993b49426 100644
--- a/internal/service/conflicts/list_conflict_files_test.go
+++ b/internal/service/conflicts/list_conflict_files_test.go
@@ -113,7 +113,7 @@ func TestFailedListConflictFilesRequestDueToConflictSideMissing(t *testing.T) {
}
c, _ := client.ListConflictFiles(ctx, request)
- testhelper.AssertGrpcError(t, drainListConflictFilesResponse(c), codes.FailedPrecondition, "")
+ testhelper.RequireGrpcError(t, drainListConflictFilesResponse(c), codes.FailedPrecondition)
}
func TestFailedListConflictFilesRequestDueToValidation(t *testing.T) {
@@ -169,7 +169,7 @@ func TestFailedListConflictFilesRequestDueToValidation(t *testing.T) {
defer cancel()
c, _ := client.ListConflictFiles(ctx, testCase.request)
- testhelper.AssertGrpcError(t, drainListConflictFilesResponse(c), testCase.code, "")
+ testhelper.RequireGrpcError(t, drainListConflictFilesResponse(c), testCase.code)
})
}
}
diff --git a/internal/service/conflicts/resolve_conflicts_test.go b/internal/service/conflicts/resolve_conflicts_test.go
index 775695a6c..30c3796c2 100644
--- a/internal/service/conflicts/resolve_conflicts_test.go
+++ b/internal/service/conflicts/resolve_conflicts_test.go
@@ -302,7 +302,7 @@ func TestFailedResolveConflictsRequestDueToValidation(t *testing.T) {
require.NoError(t, stream.Send(headerRequest))
_, err = stream.CloseAndRecv()
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/diff/commit_test.go b/internal/service/diff/commit_test.go
index a5891d366..967e4d4d1 100644
--- a/internal/service/diff/commit_test.go
+++ b/internal/service/diff/commit_test.go
@@ -650,7 +650,7 @@ func TestFailedCommitDiffRequestDueToValidationError(t *testing.T) {
}
err = drainCommitDiffResponse(c)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
@@ -677,7 +677,7 @@ func TestFailedCommitDiffRequestWithNonExistentCommit(t *testing.T) {
}
err = drainCommitDiffResponse(c)
- testhelper.AssertGrpcError(t, err, codes.Unavailable, "")
+ testhelper.RequireGrpcError(t, err, codes.Unavailable)
}
func TestSuccessfulCommitDeltaRequest(t *testing.T) {
@@ -903,7 +903,7 @@ func TestFailedCommitDeltaRequestDueToValidationError(t *testing.T) {
}
err = drainCommitDeltaResponse(c)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
@@ -930,7 +930,7 @@ func TestFailedCommitDeltaRequestWithNonExistentCommit(t *testing.T) {
}
err = drainCommitDeltaResponse(c)
- testhelper.AssertGrpcError(t, err, codes.Unavailable, "")
+ testhelper.RequireGrpcError(t, err, codes.Unavailable)
}
func drainCommitDiffResponse(c pb.Diff_CommitDiffClient) error {
diff --git a/internal/service/diff/raw_test.go b/internal/service/diff/raw_test.go
index 21c85867c..52cdc655e 100644
--- a/internal/service/diff/raw_test.go
+++ b/internal/service/diff/raw_test.go
@@ -107,7 +107,7 @@ func TestFailedRawDiffRequestDueToValidations(t *testing.T) {
defer cancel()
c, _ := client.RawDiff(ctx, testCase.request)
- testhelper.AssertGrpcError(t, drainRawDiffResponse(c), testCase.code, "")
+ testhelper.RequireGrpcError(t, drainRawDiffResponse(c), testCase.code)
})
}
}
@@ -199,7 +199,7 @@ func TestFailedRawPatchRequestDueToValidations(t *testing.T) {
defer cancel()
c, _ := client.RawPatch(ctx, testCase.request)
- testhelper.AssertGrpcError(t, drainRawPatchResponse(c), testCase.code, "")
+ testhelper.RequireGrpcError(t, drainRawPatchResponse(c), testCase.code)
})
}
}
diff --git a/internal/service/notifications/post_receive_test.go b/internal/service/notifications/post_receive_test.go
index 6d9e2d4af..5e77f9f20 100644
--- a/internal/service/notifications/post_receive_test.go
+++ b/internal/service/notifications/post_receive_test.go
@@ -45,7 +45,7 @@ func TestEmptyPostReceiveRequest(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_, err := client.PostReceive(ctx, rpcRequest)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
}
func runNotificationsServer(t *testing.T) (*grpc.Server, string) {
diff --git a/internal/service/operations/branches_test.go b/internal/service/operations/branches_test.go
index 82b3d0191..b6b67f921 100644
--- a/internal/service/operations/branches_test.go
+++ b/internal/service/operations/branches_test.go
@@ -239,7 +239,7 @@ func TestFailedUserCreateBranchRequest(t *testing.T) {
defer cancel()
_, err := client.UserCreateBranch(ctx, request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
@@ -383,7 +383,7 @@ func TestFailedUserDeleteBranchDueToValidation(t *testing.T) {
defer cancel()
_, err := client.UserDeleteBranch(ctx, testCase.request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/operations/cherry_pick_test.go b/internal/service/operations/cherry_pick_test.go
index 36f21d1cb..6c64b4378 100644
--- a/internal/service/operations/cherry_pick_test.go
+++ b/internal/service/operations/cherry_pick_test.go
@@ -261,7 +261,7 @@ func TestFailedUserCherryPickRequestDueToValidations(t *testing.T) {
ctx := metadata.NewOutgoingContext(ctxOuter, md)
_, err := client.UserCherryPick(ctx, testCase.request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/operations/commit_files_test.go b/internal/service/operations/commit_files_test.go
index ed6919fe7..5ab3a44c3 100644
--- a/internal/service/operations/commit_files_test.go
+++ b/internal/service/operations/commit_files_test.go
@@ -232,7 +232,7 @@ func TestFailedUserCommitFilesRequest(t *testing.T) {
require.NoError(t, stream.Send(tc.req))
_, err = stream.CloseAndRecv()
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, tc.desc)
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/operations/merge_test.go b/internal/service/operations/merge_test.go
index 932d56fe5..fb75f3bb9 100644
--- a/internal/service/operations/merge_test.go
+++ b/internal/service/operations/merge_test.go
@@ -414,7 +414,7 @@ func TestFailedUserFFBranchRequest(t *testing.T) {
CommitId: testCase.commitID,
}
_, err := client.UserFFBranch(ctx, request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/operations/rebase_test.go b/internal/service/operations/rebase_test.go
index 22f67ba93..9de5af113 100644
--- a/internal/service/operations/rebase_test.go
+++ b/internal/service/operations/rebase_test.go
@@ -290,7 +290,7 @@ func TestFailedUserRebaseRequestDueToValidations(t *testing.T) {
ctx := metadata.NewOutgoingContext(ctxOuter, md)
_, err := client.UserRebase(ctx, testCase.request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/operations/revert_test.go b/internal/service/operations/revert_test.go
index a6132c195..e8e32158d 100644
--- a/internal/service/operations/revert_test.go
+++ b/internal/service/operations/revert_test.go
@@ -258,7 +258,7 @@ func TestFailedUserRevertRequestDueToValidations(t *testing.T) {
ctx := metadata.NewOutgoingContext(ctxOuter, md)
_, err := client.UserRevert(ctx, testCase.request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/operations/squash_test.go b/internal/service/operations/squash_test.go
index f256cdb6a..fe1eea846 100644
--- a/internal/service/operations/squash_test.go
+++ b/internal/service/operations/squash_test.go
@@ -229,7 +229,7 @@ func TestFailedUserSquashRequestDueToValidations(t *testing.T) {
defer cancel()
_, err := client.UserSquash(ctx, testCase.request)
- testhelper.AssertGrpcError(t, err, testCase.code, testCase.desc)
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/operations/tags_test.go b/internal/service/operations/tags_test.go
index a2f18b1ea..c695a8762 100644
--- a/internal/service/operations/tags_test.go
+++ b/internal/service/operations/tags_test.go
@@ -285,7 +285,7 @@ func TestFailedUserDeleteTagRequestDueToValidation(t *testing.T) {
defer cancel()
_, err := client.UserDeleteTag(ctx, testCase.request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
@@ -476,7 +476,7 @@ func TestFailedUserCreateTagRequestDueToValidation(t *testing.T) {
defer cancel()
_, err := client.UserCreateTag(ctx, request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/ref/branches_test.go b/internal/service/ref/branches_test.go
index 31c568b9d..d1860c53f 100644
--- a/internal/service/ref/branches_test.go
+++ b/internal/service/ref/branches_test.go
@@ -219,7 +219,7 @@ func TestFailedDeleteBranchRequest(t *testing.T) {
defer cancel()
_, err := client.DeleteBranch(ctx, request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
@@ -324,7 +324,7 @@ func TestFailedFindBranchRequest(t *testing.T) {
defer cancel()
_, err := client.FindBranch(ctx, request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/ref/delete_refs_test.go b/internal/service/ref/delete_refs_test.go
index 05c74d3ef..54487cec8 100644
--- a/internal/service/ref/delete_refs_test.go
+++ b/internal/service/ref/delete_refs_test.go
@@ -161,7 +161,7 @@ func TestFailedDeleteRefsDueToValidation(t *testing.T) {
defer cancel()
_, err := client.DeleteRefs(ctx, tc.request)
- testhelper.AssertGrpcError(t, err, tc.code, "")
+ testhelper.RequireGrpcError(t, err, tc.code)
})
}
}
diff --git a/internal/service/ref/refs_test.go b/internal/service/ref/refs_test.go
index 4d593117e..134e43b7c 100644
--- a/internal/service/ref/refs_test.go
+++ b/internal/service/ref/refs_test.go
@@ -573,7 +573,7 @@ func TestInvalidFindAllTagsRequest(t *testing.T) {
_, recvError = c.Recv()
}
- testhelper.AssertGrpcError(t, recvError, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, recvError, codes.InvalidArgument)
})
}
}
@@ -927,7 +927,7 @@ func TestInvalidFindAllBranchesRequest(t *testing.T) {
_, recvError = c.Recv()
}
- testhelper.AssertGrpcError(t, recvError, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, recvError, codes.InvalidArgument)
})
}
}
@@ -1005,7 +1005,7 @@ func TestListTagNamesContainingCommit(t *testing.T) {
if err == io.EOF {
break
} else if tc.code != codes.OK {
- testhelper.AssertGrpcError(t, err, tc.code, "")
+ testhelper.RequireGrpcError(t, err, tc.code)
return
}
@@ -1099,7 +1099,7 @@ func TestListBranchNamesContainingCommit(t *testing.T) {
if err == io.EOF {
break
} else if tc.code != codes.OK {
- testhelper.AssertGrpcError(t, err, tc.code, "")
+ testhelper.RequireGrpcError(t, err, tc.code)
return
}
diff --git a/internal/service/ref/tag_messages_test.go b/internal/service/ref/tag_messages_test.go
index 0c29ca768..3361026d2 100644
--- a/internal/service/ref/tag_messages_test.go
+++ b/internal/service/ref/tag_messages_test.go
@@ -93,7 +93,7 @@ func TestFailedGetTagMessagesRequest(t *testing.T) {
}
}
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/remote/fetch_internal_remote_test.go b/internal/service/remote/fetch_internal_remote_test.go
index fbcd706e0..454f51cec 100644
--- a/internal/service/remote/fetch_internal_remote_test.go
+++ b/internal/service/remote/fetch_internal_remote_test.go
@@ -110,7 +110,7 @@ func TestFailedFetchInternalRemoteDueToValidations(t *testing.T) {
t.Run(tc.desc, func(t *testing.T) {
_, err := client.FetchInternalRemote(ctx, tc.request)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, tc.desc)
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/remote/remotes_test.go b/internal/service/remote/remotes_test.go
index 5c18e90fe..a3c33e1ff 100644
--- a/internal/service/remote/remotes_test.go
+++ b/internal/service/remote/remotes_test.go
@@ -144,7 +144,7 @@ func TestFailedAddRemoteDueToValidation(t *testing.T) {
}
_, err := client.AddRemote(ctx, request)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
@@ -215,7 +215,7 @@ func TestFailedRemoveRemoteDueToValidation(t *testing.T) {
request := &pb.RemoveRemoteRequest{Repository: testRepo} // Remote name empty
_, err := client.RemoveRemote(ctx, request)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
}
func TestFindRemoteRepository(t *testing.T) {
@@ -266,7 +266,7 @@ func TestFailedFindRemoteRepository(t *testing.T) {
if tc.code == codes.OK {
require.NoError(t, err)
} else {
- testhelper.AssertGrpcError(t, err, tc.code, "")
+ testhelper.RequireGrpcError(t, err, tc.code)
continue
}
diff --git a/internal/service/remote/update_remote_mirror_test.go b/internal/service/remote/update_remote_mirror_test.go
index 07ed5eee4..2bb11a014 100644
--- a/internal/service/remote/update_remote_mirror_test.go
+++ b/internal/service/remote/update_remote_mirror_test.go
@@ -119,7 +119,7 @@ func TestFailedUpdateRemoteMirrorRequestDueToValidation(t *testing.T) {
require.NoError(t, stream.Send(tc.request))
_, err = stream.CloseAndRecv()
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, tc.desc)
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/repository/apply_gitattributes_test.go b/internal/service/repository/apply_gitattributes_test.go
index 7fcabb297..76688c92d 100644
--- a/internal/service/repository/apply_gitattributes_test.go
+++ b/internal/service/repository/apply_gitattributes_test.go
@@ -120,7 +120,7 @@ func TestApplyGitattributesFailure(t *testing.T) {
req := &pb.ApplyGitattributesRequest{Repository: test.repo, Revision: test.revision}
_, err := client.ApplyGitattributes(ctx, req)
- testhelper.AssertGrpcError(t, err, test.code, "")
+ testhelper.RequireGrpcError(t, err, test.code)
})
}
}
diff --git a/internal/service/repository/archive_test.go b/internal/service/repository/archive_test.go
index 148ecebf4..2f543f373 100644
--- a/internal/service/repository/archive_test.go
+++ b/internal/service/repository/archive_test.go
@@ -155,7 +155,7 @@ func TestGetArchiveFailure(t *testing.T) {
require.NoError(t, err)
_, err = consumeArchive(stream)
- testhelper.AssertGrpcError(t, err, tc.code, "")
+ testhelper.RequireGrpcError(t, err, tc.code)
})
}
}
diff --git a/internal/service/repository/calculate_checksum_test.go b/internal/service/repository/calculate_checksum_test.go
index a5c2f029a..b507c6abd 100644
--- a/internal/service/repository/calculate_checksum_test.go
+++ b/internal/service/repository/calculate_checksum_test.go
@@ -75,7 +75,7 @@ func TestBrokenRepositoryCalculateChecksum(t *testing.T) {
defer cancelCtx()
_, err := client.CalculateChecksum(testCtx, request)
- testhelper.AssertGrpcError(t, err, codes.DataLoss, "not a git repository")
+ testhelper.RequireGrpcError(t, err, codes.DataLoss)
}
func TestFailedCalculateChecksum(t *testing.T) {
@@ -109,6 +109,6 @@ func TestFailedCalculateChecksum(t *testing.T) {
defer cancelCtx()
_, err := client.CalculateChecksum(testCtx, testCase.request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
}
}
diff --git a/internal/service/repository/create_bundle_test.go b/internal/service/repository/create_bundle_test.go
index 559c3c64f..6efe22338 100644
--- a/internal/service/repository/create_bundle_test.go
+++ b/internal/service/repository/create_bundle_test.go
@@ -83,7 +83,7 @@ func TestFailedCreateBundleRequestDueToValidations(t *testing.T) {
_, err = stream.Recv()
require.NotEqual(t, io.EOF, err)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/repository/create_from_bundle_test.go b/internal/service/repository/create_from_bundle_test.go
index 18ed59edc..3c2cbdd20 100644
--- a/internal/service/repository/create_from_bundle_test.go
+++ b/internal/service/repository/create_from_bundle_test.go
@@ -94,5 +94,5 @@ func TestFailedCreateRepositoryFromBundleRequestDueToValidations(t *testing.T) {
require.NoError(t, stream.Send(&pb.CreateRepositoryFromBundleRequest{}))
_, err = stream.CloseAndRecv()
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
}
diff --git a/internal/service/repository/create_from_snapshot_test.go b/internal/service/repository/create_from_snapshot_test.go
index c44630810..4730bbf43 100644
--- a/internal/service/repository/create_from_snapshot_test.go
+++ b/internal/service/repository/create_from_snapshot_test.go
@@ -118,7 +118,7 @@ func TestCreateRepositoryFromSnapshotFailsIfRepositoryExists(t *testing.T) {
req := &pb.CreateRepositoryFromSnapshotRequest{Repository: testRepo}
rsp, err := createFromSnapshot(t, req)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "destination directory exists")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
require.Nil(t, rsp)
}
@@ -132,7 +132,7 @@ func TestCreateRepositoryFromSnapshotFailsIfBadURL(t *testing.T) {
}
rsp, err := createFromSnapshot(t, req)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "Bad HTTP URL")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
require.Nil(t, rsp)
}
@@ -151,7 +151,7 @@ func TestCreateRepositoryFromSnapshotFailsIfBadAuth(t *testing.T) {
}
rsp, err := createFromSnapshot(t, req)
- testhelper.AssertGrpcError(t, err, codes.Internal, "HTTP server: 401 Unauthorized")
+ testhelper.RequireGrpcError(t, err, codes.Internal)
require.Nil(t, rsp)
}
@@ -170,7 +170,7 @@ func TestCreateRepositoryFromSnapshotFailsIfHttp404(t *testing.T) {
}
rsp, err := createFromSnapshot(t, req)
- testhelper.AssertGrpcError(t, err, codes.Internal, "HTTP server: 404 Not Found")
+ testhelper.RequireGrpcError(t, err, codes.Internal)
require.Nil(t, rsp)
}
@@ -189,7 +189,7 @@ func TestCreateRepositoryFromSnapshotDoesNotFollowRedirects(t *testing.T) {
}
rsp, err := createFromSnapshot(t, req)
- testhelper.AssertGrpcError(t, err, codes.Internal, "HTTP server: 302 Found")
+ testhelper.RequireGrpcError(t, err, codes.Internal)
require.Nil(t, rsp)
}
diff --git a/internal/service/repository/create_from_url_test.go b/internal/service/repository/create_from_url_test.go
index ba8aa6d16..79e997245 100644
--- a/internal/service/repository/create_from_url_test.go
+++ b/internal/service/repository/create_from_url_test.go
@@ -102,7 +102,7 @@ func TestFailedCreateRepositoryFromURLRequestDueToExistingTarget(t *testing.T) {
}
_, err = client.CreateRepositoryFromURL(ctx, req)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/repository/create_test.go b/internal/service/repository/create_test.go
index 5f2e6f6fb..5817af8e7 100644
--- a/internal/service/repository/create_test.go
+++ b/internal/service/repository/create_test.go
@@ -75,7 +75,7 @@ func TestCreateRepositoryFailure(t *testing.T) {
Repository: &pb.Repository{StorageName: "default", RelativePath: "foo.git"},
})
- testhelper.AssertGrpcError(t, err, codes.Unknown, "")
+ testhelper.RequireGrpcError(t, err, codes.Unknown)
}
func TestCreateRepositoryFailureInvalidArgs(t *testing.T) {
@@ -103,7 +103,7 @@ func TestCreateRepositoryFailureInvalidArgs(t *testing.T) {
_, err := client.CreateRepository(ctx, &pb.CreateRepositoryRequest{Repository: tc.repo})
require.Error(t, err)
- testhelper.AssertGrpcError(t, err, tc.code, "")
+ testhelper.RequireGrpcError(t, err, tc.code)
})
}
}
diff --git a/internal/service/repository/fetch_remote_test.go b/internal/service/repository/fetch_remote_test.go
index 8f18d4af3..1182b998a 100644
--- a/internal/service/repository/fetch_remote_test.go
+++ b/internal/service/repository/fetch_remote_test.go
@@ -88,7 +88,7 @@ func TestFetchRemoteFailure(t *testing.T) {
defer cancel()
resp, err := client.FetchRemote(ctx, tc.req)
- testhelper.AssertGrpcError(t, err, tc.code, tc.err)
+ testhelper.RequireGrpcError(t, err, tc.code)
assert.Error(t, err)
assert.Nil(t, resp)
})
diff --git a/internal/service/repository/fetch_test.go b/internal/service/repository/fetch_test.go
index 28012bc9c..9fcd6f59d 100644
--- a/internal/service/repository/fetch_test.go
+++ b/internal/service/repository/fetch_test.go
@@ -169,7 +169,7 @@ func TestFetchFullServerRequiresAuthentication(t *testing.T) {
client := healthpb.NewHealthClient(conn)
_, err = client.Check(ctx, &healthpb.HealthCheckRequest{})
- testhelper.AssertGrpcError(t, err, codes.Unauthenticated, "")
+ testhelper.RequireGrpcError(t, err, codes.Unauthenticated)
}
func newTestRepo(t *testing.T, relativePath string) (*pb.Repository, string) {
diff --git a/internal/service/repository/fork_test.go b/internal/service/repository/fork_test.go
index a9ea3ee5f..0d06858e7 100644
--- a/internal/service/repository/fork_test.go
+++ b/internal/service/repository/fork_test.go
@@ -116,7 +116,7 @@ func TestFailedCreateForkRequestDueToExistingTarget(t *testing.T) {
}
_, err = client.CreateFork(ctx, req)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/repository/gc_test.go b/internal/service/repository/gc_test.go
index 951f983c4..f9e9fa511 100644
--- a/internal/service/repository/gc_test.go
+++ b/internal/service/repository/gc_test.go
@@ -116,7 +116,7 @@ func TestGarbageCollectDeletesRefsLocks(t *testing.T) {
createFileWithTimes(deleteLockPath, oldTime)
c, err := client.GarbageCollect(ctx, req)
- testhelper.AssertGrpcError(t, err, codes.Internal, "GarbageCollect: cmd wait")
+ testhelper.RequireGrpcError(t, err, codes.Internal)
assert.Nil(t, c)
// Sanity checks
@@ -154,7 +154,7 @@ func TestGarbageCollectFailure(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_, err := client.GarbageCollect(ctx, &pb.GarbageCollectRequest{Repository: test.repo})
- testhelper.AssertGrpcError(t, err, test.code, "")
+ testhelper.RequireGrpcError(t, err, test.code)
})
}
diff --git a/internal/service/repository/merge_base_test.go b/internal/service/repository/merge_base_test.go
index 4c429deae..79688ae69 100644
--- a/internal/service/repository/merge_base_test.go
+++ b/internal/service/repository/merge_base_test.go
@@ -122,7 +122,7 @@ func TestFailedFindMergeBaseRequestDueToValidations(t *testing.T) {
}
_, err := client.FindMergeBase(ctx, request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/repository/raw_changes_test.go b/internal/service/repository/raw_changes_test.go
index 77e632d5a..0ed8ad654 100644
--- a/internal/service/repository/raw_changes_test.go
+++ b/internal/service/repository/raw_changes_test.go
@@ -91,7 +91,7 @@ func TestGetRawChangesFailures(t *testing.T) {
require.NoError(t, err)
_, err = resp.Recv()
- testhelper.AssertGrpcError(t, err, tc.code, "")
+ testhelper.RequireGrpcError(t, err, tc.code)
}
}
diff --git a/internal/service/repository/rebase_in_progress_test.go b/internal/service/repository/rebase_in_progress_test.go
index d34165951..ab0c212e3 100644
--- a/internal/service/repository/rebase_in_progress_test.go
+++ b/internal/service/repository/rebase_in_progress_test.go
@@ -125,7 +125,7 @@ func TestFailedIsRebaseInProgressRequestDueToValidations(t *testing.T) {
defer cancel()
_, err := client.IsRebaseInProgress(ctx, testCase.request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/repository/repack_test.go b/internal/service/repository/repack_test.go
index c443d1f9d..c3f3bc6d8 100644
--- a/internal/service/repository/repack_test.go
+++ b/internal/service/repository/repack_test.go
@@ -65,7 +65,7 @@ func TestRepackIncrementalFailure(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_, err := client.RepackIncremental(ctx, &pb.RepackIncrementalRequest{Repository: test.repo})
- testhelper.AssertGrpcError(t, err, test.code, "")
+ testhelper.RequireGrpcError(t, err, test.code)
})
}
}
@@ -145,7 +145,7 @@ func TestRepackFullFailure(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_, err := client.RepackFull(ctx, &pb.RepackFullRequest{Repository: test.repo})
- testhelper.AssertGrpcError(t, err, test.code, "")
+ testhelper.RequireGrpcError(t, err, test.code)
})
}
}
diff --git a/internal/service/repository/search_files_test.go b/internal/service/repository/search_files_test.go
index 2679e4715..f81c7d124 100644
--- a/internal/service/repository/search_files_test.go
+++ b/internal/service/repository/search_files_test.go
@@ -181,7 +181,7 @@ func TestSearchFilesByContentFailure(t *testing.T) {
require.NoError(t, err)
_, err = consumeFilenameByContent(stream)
- testhelper.AssertGrpcError(t, err, tc.code, tc.msg)
+ testhelper.RequireGrpcError(t, err, tc.code)
})
}
}
@@ -285,7 +285,7 @@ func TestSearchFilesByNameFailure(t *testing.T) {
require.NoError(t, err)
_, err = consumeFilenameByName(stream)
- testhelper.AssertGrpcError(t, err, tc.code, tc.msg)
+ testhelper.RequireGrpcError(t, err, tc.code)
})
}
}
diff --git a/internal/service/repository/size_test.go b/internal/service/repository/size_test.go
index c3c022d91..c8aff97fe 100644
--- a/internal/service/repository/size_test.go
+++ b/internal/service/repository/size_test.go
@@ -77,7 +77,7 @@ func TestFailedRepositorySizeRequest(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_, err := client.RepositorySize(ctx, request)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/repository/snapshot_test.go b/internal/service/repository/snapshot_test.go
index ce0f4e926..d50d73c8b 100644
--- a/internal/service/repository/snapshot_test.go
+++ b/internal/service/repository/snapshot_test.go
@@ -91,7 +91,7 @@ func TestGetSnapshotFailsIfRepositoryMissing(t *testing.T) {
req := &pb.GetSnapshotRequest{Repository: testRepo}
data, err := getSnapshot(t, req)
- testhelper.AssertGrpcError(t, err, codes.NotFound, "not a git repository")
+ testhelper.RequireGrpcError(t, err, codes.NotFound)
require.Empty(t, data)
}
@@ -106,7 +106,7 @@ func TestGetSnapshotFailsIfRepositoryContainsSymlink(t *testing.T) {
req := &pb.GetSnapshotRequest{Repository: testRepo}
data, err := getSnapshot(t, req)
- testhelper.AssertGrpcError(t, err, codes.Internal, "Building snapshot failed")
+ testhelper.RequireGrpcError(t, err, codes.Internal)
// At least some of the tar file should have been written so far
require.NotEmpty(t, data)
diff --git a/internal/service/repository/squash_in_progress_test.go b/internal/service/repository/squash_in_progress_test.go
index 5d16545aa..97b8df802 100644
--- a/internal/service/repository/squash_in_progress_test.go
+++ b/internal/service/repository/squash_in_progress_test.go
@@ -93,7 +93,7 @@ func TestFailedIsSquashInProgressRequestDueToValidations(t *testing.T) {
defer cancel()
_, err := client.IsSquashInProgress(ctx, testCase.request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/repository/write_config_test.go b/internal/service/repository/write_config_test.go
index f25e0a2df..cbd4a3ee9 100644
--- a/internal/service/repository/write_config_test.go
+++ b/internal/service/repository/write_config_test.go
@@ -80,7 +80,7 @@ func TestWriteConfigFailure(t *testing.T) {
defer cancel()
c, err := client.WriteConfig(ctx, &pb.WriteConfigRequest{Repository: tc.repo, FullPath: tc.path})
- testhelper.AssertGrpcError(t, err, codes.NotFound, "")
+ testhelper.RequireGrpcError(t, err, codes.NotFound)
require.Nil(t, c)
require.Empty(t, c.GetError())
})
diff --git a/internal/service/repository/write_ref_test.go b/internal/service/repository/write_ref_test.go
index 9be86546c..3557631da 100644
--- a/internal/service/repository/write_ref_test.go
+++ b/internal/service/repository/write_ref_test.go
@@ -167,7 +167,7 @@ func TestWriteRefValidationError(t *testing.T) {
defer cancel()
_, err := client.WriteRef(ctx, tc.req)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/smarthttp/inforefs_test.go b/internal/service/smarthttp/inforefs_test.go
index dbb65e2dc..24ca0760a 100644
--- a/internal/service/smarthttp/inforefs_test.go
+++ b/internal/service/smarthttp/inforefs_test.go
@@ -120,7 +120,7 @@ func TestFailureRepoNotFoundInfoRefsReceivePack(t *testing.T) {
for err == nil {
_, err = c.Recv()
}
- testhelper.AssertGrpcError(t, err, codes.NotFound, "not a git repository")
+ testhelper.RequireGrpcError(t, err, codes.NotFound)
}
func TestFailureRepoNotSetInfoRefsReceivePack(t *testing.T) {
@@ -141,7 +141,7 @@ func TestFailureRepoNotSetInfoRefsReceivePack(t *testing.T) {
for err == nil {
_, err = c.Recv()
}
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
}
func assertGitRefAdvertisement(t *testing.T, rpc, responseBody string, firstLine, lastLine string, middleLines []string) {
diff --git a/internal/service/smarthttp/receive_pack_test.go b/internal/service/smarthttp/receive_pack_test.go
index cafc84b0e..7575d77e1 100644
--- a/internal/service/smarthttp/receive_pack_test.go
+++ b/internal/service/smarthttp/receive_pack_test.go
@@ -131,7 +131,7 @@ func TestFailedReceivePackRequestDueToValidationError(t *testing.T) {
stream.CloseSend()
err = drainPostReceivePackResponse(stream)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/smarthttp/upload_pack_test.go b/internal/service/smarthttp/upload_pack_test.go
index 9922463aa..d3f20b2fa 100644
--- a/internal/service/smarthttp/upload_pack_test.go
+++ b/internal/service/smarthttp/upload_pack_test.go
@@ -143,7 +143,7 @@ func TestUploadPackRequestWithGitConfigOptions(t *testing.T) {
// client just sees a grpc unavailable error
rpcRequest.GitConfigOptions = []string{"uploadpack.hideRefs=refs/hidden"}
response, err = makePostUploadPackRequest(t, serverSocketPath, rpcRequest, requestBodyCopy)
- testhelper.AssertGrpcError(t, err, codes.Unavailable, "")
+ testhelper.RequireGrpcError(t, err, codes.Unavailable)
assert.Equal(t, response.String(), "", "Ref is hidden so no response should be received")
}
@@ -182,7 +182,7 @@ func TestFailedUploadPackRequestDueToValidationError(t *testing.T) {
for _, rpcRequest := range rpcRequests {
t.Run(fmt.Sprintf("%v", rpcRequest), func(t *testing.T) {
_, err := makePostUploadPackRequest(t, serverSocketPath, &rpcRequest, bytes.NewBuffer(nil))
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
})
}
}
diff --git a/internal/service/ssh/receive_pack_test.go b/internal/service/ssh/receive_pack_test.go
index 055d5b27a..9aa6754eb 100644
--- a/internal/service/ssh/receive_pack_test.go
+++ b/internal/service/ssh/receive_pack_test.go
@@ -70,7 +70,7 @@ func TestFailedReceivePackRequestDueToValidationError(t *testing.T) {
stream.CloseSend()
err = drainPostReceivePackResponse(stream)
- testhelper.AssertGrpcError(t, err, test.Code, "")
+ testhelper.RequireGrpcError(t, err, test.Code)
})
}
}
diff --git a/internal/service/ssh/upload_archive_test.go b/internal/service/ssh/upload_archive_test.go
index 9b0cea4a9..682808243 100644
--- a/internal/service/ssh/upload_archive_test.go
+++ b/internal/service/ssh/upload_archive_test.go
@@ -61,7 +61,7 @@ func TestFailedUploadArchiveRequestDueToValidationError(t *testing.T) {
stream.CloseSend()
err = drainUploadArchiveResponse(stream)
- testhelper.AssertGrpcError(t, err, test.Code, "")
+ testhelper.RequireGrpcError(t, err, test.Code)
})
}
}
diff --git a/internal/service/ssh/upload_pack_test.go b/internal/service/ssh/upload_pack_test.go
index df98faa7b..99a40add0 100644
--- a/internal/service/ssh/upload_pack_test.go
+++ b/internal/service/ssh/upload_pack_test.go
@@ -64,7 +64,7 @@ func TestFailedUploadPackRequestDueToValidationError(t *testing.T) {
stream.CloseSend()
err = drainPostUploadPackResponse(stream)
- testhelper.AssertGrpcError(t, err, test.Code, "")
+ testhelper.RequireGrpcError(t, err, test.Code)
})
}
}
diff --git a/internal/service/wiki/delete_page_test.go b/internal/service/wiki/delete_page_test.go
index ec9af3199..5dc4cd402 100644
--- a/internal/service/wiki/delete_page_test.go
+++ b/internal/service/wiki/delete_page_test.go
@@ -181,7 +181,7 @@ func TestFailedWikiDeletePageDueToValidations(t *testing.T) {
defer cancel()
_, err := client.WikiDeletePage(ctx, testCase.request)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/wiki/find_file_test.go b/internal/service/wiki/find_file_test.go
index 3ef73d97b..c23bc109d 100644
--- a/internal/service/wiki/find_file_test.go
+++ b/internal/service/wiki/find_file_test.go
@@ -178,7 +178,7 @@ func TestFailedWikiFindFileDueToValidation(t *testing.T) {
require.NoError(t, err)
err = drainWikiFindFileResponse(c)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/wiki/find_page_test.go b/internal/service/wiki/find_page_test.go
index 44a0e0ac5..955961af3 100644
--- a/internal/service/wiki/find_page_test.go
+++ b/internal/service/wiki/find_page_test.go
@@ -318,7 +318,7 @@ func TestFailedWikiFindPageDueToValidation(t *testing.T) {
require.NoError(t, err)
err = drainWikiFindPageResponse(c)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/wiki/formatted_data_test.go b/internal/service/wiki/formatted_data_test.go
index fecd8caef..8bc45453a 100644
--- a/internal/service/wiki/formatted_data_test.go
+++ b/internal/service/wiki/formatted_data_test.go
@@ -117,7 +117,7 @@ func TestFailedWikiGetFormattedDataDueToValidation(t *testing.T) {
require.NoError(t, err)
err = drainWikiGetFormattedDataResponse(c)
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/wiki/get_all_pages_test.go b/internal/service/wiki/get_all_pages_test.go
index 4fefa4ada..c06d28241 100644
--- a/internal/service/wiki/get_all_pages_test.go
+++ b/internal/service/wiki/get_all_pages_test.go
@@ -81,7 +81,7 @@ func TestFailedWikiGetAllPagesDueToValidation(t *testing.T) {
require.NoError(t, err)
err = drainWikiGetAllPagesResponse(c)
- testhelper.AssertGrpcError(t, err, codes.InvalidArgument, "")
+ testhelper.RequireGrpcError(t, err, codes.InvalidArgument)
}
}
diff --git a/internal/service/wiki/update_page_test.go b/internal/service/wiki/update_page_test.go
index 79fcf28ba..66d076ee7 100644
--- a/internal/service/wiki/update_page_test.go
+++ b/internal/service/wiki/update_page_test.go
@@ -245,7 +245,7 @@ func TestFailedWikiUpdatePageDueToValidations(t *testing.T) {
require.NoError(t, stream.Send(testCase.request))
_, err = stream.CloseAndRecv()
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/service/wiki/write_page_test.go b/internal/service/wiki/write_page_test.go
index abb471b4e..acf500be5 100644
--- a/internal/service/wiki/write_page_test.go
+++ b/internal/service/wiki/write_page_test.go
@@ -318,7 +318,7 @@ func TestFailedWikiWritePageDueToValidations(t *testing.T) {
require.NoError(t, stream.Send(testCase.request))
_, err = stream.CloseAndRecv()
- testhelper.AssertGrpcError(t, err, testCase.code, "")
+ testhelper.RequireGrpcError(t, err, testCase.code)
})
}
}
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go
index 892c11b78..849ab380c 100644
--- a/internal/testhelper/testhelper.go
+++ b/internal/testhelper/testhelper.go
@@ -124,9 +124,9 @@ func TestRepository() *pb.Repository {
return repo
}
-// AssertGrpcError asserts the passed err is of the same code as expectedCode. Optionally, it can
+// RequireGrpcError asserts the passed err is of the same code as expectedCode. Optionally, it can
// assert the error contains the text of containsText if the latter is not an empty string.
-func AssertGrpcError(t *testing.T, err error, expectedCode codes.Code, containsText string) {
+func RequireGrpcError(t *testing.T, err error, expectedCode codes.Code) {
if err == nil {
t.Fatal("Expected an error, got nil")
}
@@ -136,10 +136,6 @@ func AssertGrpcError(t *testing.T, err error, expectedCode codes.Code, containsT
if code := status.Code(); code != expectedCode {
t.Fatalf("Expected an error with code %v, got %v. The error was %v", expectedCode, code, err)
}
-
- if containsText != "" && !strings.Contains(err.Error(), containsText) {
- t.Fatalf("Expected an error message containing %v, got %v", containsText, err.Error())
- }
}
// MustRunCommand runs a command with an optional standard input and returns the standard output, or fails.