diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2022-10-25 10:12:09 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2022-11-08 12:33:02 +0300 |
commit | 36340fafd9bca73c188afa1cafce9efd232afba5 (patch) | |
tree | 9037c5c7d527f290f5876ce2aa70187bc5c080e8 | |
parent | 94270fc83506f4b52bebb6a629097a2f39b268a9 (diff) |
testhelper: More descriptive name for GitalyOrPraefect
GitalyOrPraefect now renamed to GitalyOrPraefectMessage
as it is more descriptive.
88 files changed, 164 insertions, 164 deletions
diff --git a/internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go b/internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go index 388c4b973..777bc0897 100644 --- a/internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go +++ b/internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go @@ -128,7 +128,7 @@ func TestApplyBfgObjectMapStreamFailsOnInvalidInput(t *testing.T) { t.Run("no repository provided", func(t *testing.T) { entries, err := doStreamingRequest(t, ctx, nil, client, objectMapData) require.Empty(t, entries) - testhelper.RequireGrpcError(t, status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + testhelper.RequireGrpcError(t, status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), err) diff --git a/internal/gitaly/service/commit/check_objects_exist_test.go b/internal/gitaly/service/commit/check_objects_exist_test.go index 2f39d9ecd..76efbe2c3 100644 --- a/internal/gitaly/service/commit/check_objects_exist_test.go +++ b/internal/gitaly/service/commit/check_objects_exist_test.go @@ -43,7 +43,7 @@ func TestCheckObjectsExist(t *testing.T) { { desc: "no repository provided", requests: []*gitalypb.CheckObjectsExistRequest{{Repository: nil}}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/commit_messages_test.go b/internal/gitaly/service/commit/commit_messages_test.go index c7731707b..0f6cb41ff 100644 --- a/internal/gitaly/service/commit/commit_messages_test.go +++ b/internal/gitaly/service/commit/commit_messages_test.go @@ -75,7 +75,7 @@ func TestFailedGetCommitMessagesRequest(t *testing.T) { Repository: nil, CommitIds: []string{"5937ac0a7beb003549fc5fd26fc247adbce4a52e"}, }, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/commit_signatures_test.go b/internal/gitaly/service/commit/commit_signatures_test.go index f85a0b1bb..463a6d00e 100644 --- a/internal/gitaly/service/commit/commit_signatures_test.go +++ b/internal/gitaly/service/commit/commit_signatures_test.go @@ -103,7 +103,7 @@ func TestFailedGetCommitSignaturesRequest(t *testing.T) { Repository: nil, CommitIds: []string{"5937ac0a7beb003549fc5fd26fc247adbce4a52e"}, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "GetCommitSignatures: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/commits_by_message_test.go b/internal/gitaly/service/commit/commits_by_message_test.go index 1f91de9bb..defbad8b0 100644 --- a/internal/gitaly/service/commit/commits_by_message_test.go +++ b/internal/gitaly/service/commit/commits_by_message_test.go @@ -174,7 +174,7 @@ func TestFailedCommitsByMessageRequest(t *testing.T) { { desc: "Invalid repository", request: &gitalypb.CommitsByMessageRequest{Repository: invalidRepo, Query: "foo"}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), @@ -182,7 +182,7 @@ func TestFailedCommitsByMessageRequest(t *testing.T) { { desc: "Repository is nil", request: &gitalypb.CommitsByMessageRequest{Query: "foo"}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/count_commits_test.go b/internal/gitaly/service/commit/count_commits_test.go index 38a75c5f5..6cee39aff 100644 --- a/internal/gitaly/service/commit/count_commits_test.go +++ b/internal/gitaly/service/commit/count_commits_test.go @@ -172,7 +172,7 @@ func TestFailedCountCommitsRequestDueToValidationError(t *testing.T) { { desc: "Repository doesn't exist", req: &gitalypb.CountCommitsRequest{Repository: &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}, Revision: revision}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), @@ -180,7 +180,7 @@ func TestFailedCountCommitsRequestDueToValidationError(t *testing.T) { { desc: "Repository is nil", req: &gitalypb.CountCommitsRequest{Repository: nil, Revision: revision}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "CountCommits: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/count_diverging_commits_test.go b/internal/gitaly/service/commit/count_diverging_commits_test.go index 40cc81f0e..bf6436e65 100644 --- a/internal/gitaly/service/commit/count_diverging_commits_test.go +++ b/internal/gitaly/service/commit/count_diverging_commits_test.go @@ -174,7 +174,7 @@ func TestFailedCountDivergentCommitsRequestDueToValidationError(t *testing.T) { { desc: "Repository not provided", req: &gitalypb.CountDivergingCommitsRequest{Repository: nil, From: []byte("abcdef"), To: []byte("12345")}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -182,7 +182,7 @@ func TestFailedCountDivergentCommitsRequestDueToValidationError(t *testing.T) { { desc: "Repository doesn't exist", req: &gitalypb.CountDivergingCommitsRequest{Repository: &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}, From: []byte("abcdef"), To: []byte("12345")}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `repository not valid: GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), diff --git a/internal/gitaly/service/commit/filter_shas_with_signatures_test.go b/internal/gitaly/service/commit/filter_shas_with_signatures_test.go index b50a295ee..1aa32d577 100644 --- a/internal/gitaly/service/commit/filter_shas_with_signatures_test.go +++ b/internal/gitaly/service/commit/filter_shas_with_signatures_test.go @@ -74,7 +74,7 @@ func TestFilterShasWithSignaturesValidationError(t *testing.T) { { desc: "no repository provided", req: &gitalypb.FilterShasWithSignaturesRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/find_all_commits_test.go b/internal/gitaly/service/commit/find_all_commits_test.go index 5463c2de6..9bfb96291 100644 --- a/internal/gitaly/service/commit/find_all_commits_test.go +++ b/internal/gitaly/service/commit/find_all_commits_test.go @@ -174,7 +174,7 @@ func TestFailedFindAllCommitsRequest(t *testing.T) { { desc: "Invalid repository", request: &gitalypb.FindAllCommitsRequest{Repository: invalidRepo}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), @@ -182,7 +182,7 @@ func TestFailedFindAllCommitsRequest(t *testing.T) { { desc: "Repository is nil", request: &gitalypb.FindAllCommitsRequest{}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/find_commit_test.go b/internal/gitaly/service/commit/find_commit_test.go index cb7c1deee..38af64d26 100644 --- a/internal/gitaly/service/commit/find_commit_test.go +++ b/internal/gitaly/service/commit/find_commit_test.go @@ -255,7 +255,7 @@ func TestFailedFindCommitRequest(t *testing.T) { { desc: "Repository is nil", repo: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -264,7 +264,7 @@ func TestFailedFindCommitRequest(t *testing.T) { desc: "Invalid repo", repo: invalidRepo, revision: []byte("master"), - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "GetStorageByName: no such storage: \"fake\"", "repo scoped: invalid Repository", )), diff --git a/internal/gitaly/service/commit/find_commits_test.go b/internal/gitaly/service/commit/find_commits_test.go index e3521bd83..db698d867 100644 --- a/internal/gitaly/service/commit/find_commits_test.go +++ b/internal/gitaly/service/commit/find_commits_test.go @@ -526,7 +526,7 @@ func TestFailureFindCommitsRequest(t *testing.T) { Repository: nil, Revision: []byte("HEAD"), }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/isancestor_test.go b/internal/gitaly/service/commit/isancestor_test.go index 90309528d..2dec4ada5 100644 --- a/internal/gitaly/service/commit/isancestor_test.go +++ b/internal/gitaly/service/commit/isancestor_test.go @@ -33,7 +33,7 @@ func TestCommitIsAncestorFailure(t *testing.T) { AncestorId: "b83d6e391c22777fca1ed3012fce84f633d7fed0", ChildId: "8a0f2ee90d940bfb0ba1e14e8214b0649056e4ab", }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -60,7 +60,7 @@ func TestCommitIsAncestorFailure(t *testing.T) { AncestorId: "b83d6e391c22777fca1ed3012fce84f633d7fed0", ChildId: "8a0f2ee90d940bfb0ba1e14e8214b0649056e4ab", }, - expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefectMessage( `GetRepoPath: not a git repository: "`+cfg.Storages[0].Path+`/fake-path"`, `accessor call: route repository accessor: consistent storages: repository "default"/"fake-path" not found`, )), diff --git a/internal/gitaly/service/commit/languages_test.go b/internal/gitaly/service/commit/languages_test.go index 485ec6ed1..996eb4a2d 100644 --- a/internal/gitaly/service/commit/languages_test.go +++ b/internal/gitaly/service/commit/languages_test.go @@ -155,7 +155,7 @@ func TestCommitLanguages_validateRequest(t *testing.T) { { desc: "no repository provided", req: &gitalypb.CommitLanguagesRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/last_commit_for_path_test.go b/internal/gitaly/service/commit/last_commit_for_path_test.go index 28e19c7d0..0304088e2 100644 --- a/internal/gitaly/service/commit/last_commit_for_path_test.go +++ b/internal/gitaly/service/commit/last_commit_for_path_test.go @@ -92,7 +92,7 @@ func TestFailedLastCommitForPathRequest(t *testing.T) { Repository: invalidRepo, Revision: []byte("some-branch"), }, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "GetStorageByName: no such storage: \"fake\"", "repo scoped: invalid Repository", )), @@ -102,7 +102,7 @@ func TestFailedLastCommitForPathRequest(t *testing.T) { request: &gitalypb.LastCommitForPathRequest{ Revision: []byte("some-branch"), }, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/list_all_commits_test.go b/internal/gitaly/service/commit/list_all_commits_test.go index a828df9c8..fd3e1c02c 100644 --- a/internal/gitaly/service/commit/list_all_commits_test.go +++ b/internal/gitaly/service/commit/list_all_commits_test.go @@ -153,7 +153,7 @@ func TestListAllCommits_validate(t *testing.T) { req: &gitalypb.ListAllCommitsRequest{ Repository: nil, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/list_commits_by_oid_test.go b/internal/gitaly/service/commit/list_commits_by_oid_test.go index bb7f64499..a4a5ef290 100644 --- a/internal/gitaly/service/commit/list_commits_by_oid_test.go +++ b/internal/gitaly/service/commit/list_commits_by_oid_test.go @@ -187,7 +187,7 @@ func TestListCommitsByOid_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.ListCommitsByOidRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/list_commits_by_ref_name_test.go b/internal/gitaly/service/commit/list_commits_by_ref_name_test.go index 226858b15..5a7cff626 100644 --- a/internal/gitaly/service/commit/list_commits_by_ref_name_test.go +++ b/internal/gitaly/service/commit/list_commits_by_ref_name_test.go @@ -207,7 +207,7 @@ func TestListCommitsByRefName_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.ListCommitsByRefNameRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/list_commits_test.go b/internal/gitaly/service/commit/list_commits_test.go index 5a582944e..c3b838d26 100644 --- a/internal/gitaly/service/commit/list_commits_test.go +++ b/internal/gitaly/service/commit/list_commits_test.go @@ -330,7 +330,7 @@ func TestListCommits_verify(t *testing.T) { { desc: "no repository provided", req: &gitalypb.ListCommitsRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/list_files_test.go b/internal/gitaly/service/commit/list_files_test.go index dd71af94d..f4e1c5a9b 100644 --- a/internal/gitaly/service/commit/list_files_test.go +++ b/internal/gitaly/service/commit/list_files_test.go @@ -212,7 +212,7 @@ func TestListFiles_failure(t *testing.T) { { desc: "nil repo", repo: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -220,7 +220,7 @@ func TestListFiles_failure(t *testing.T) { { desc: "empty repo object", repo: &gitalypb.Repository{}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: ""`, "repo scoped: invalid Repository", )), @@ -228,7 +228,7 @@ func TestListFiles_failure(t *testing.T) { { desc: "non-existing repo", repo: &gitalypb.Repository{StorageName: "foo", RelativePath: "bar"}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "foo"`, "repo scoped: invalid Repository", )), diff --git a/internal/gitaly/service/commit/list_last_commits_for_tree_test.go b/internal/gitaly/service/commit/list_last_commits_for_tree_test.go index e60b92096..b5cc150b1 100644 --- a/internal/gitaly/service/commit/list_last_commits_for_tree_test.go +++ b/internal/gitaly/service/commit/list_last_commits_for_tree_test.go @@ -243,7 +243,7 @@ func TestFailedListLastCommitsForTreeRequest(t *testing.T) { Offset: 0, Limit: 25, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "broken"`, "repo scoped: invalid Repository", )), @@ -256,7 +256,7 @@ func TestFailedListLastCommitsForTreeRequest(t *testing.T) { Offset: 0, Limit: 25, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/raw_blame_test.go b/internal/gitaly/service/commit/raw_blame_test.go index 9d7f3f7c2..39aadc8f4 100644 --- a/internal/gitaly/service/commit/raw_blame_test.go +++ b/internal/gitaly/service/commit/raw_blame_test.go @@ -92,7 +92,7 @@ func TestFailedRawBlameRequest(t *testing.T) { { description: "No repository provided", repo: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "RawBlame: empty Repository", "repo scoped: empty Repository", )), @@ -103,7 +103,7 @@ func TestFailedRawBlameRequest(t *testing.T) { revision: []byte("master"), path: []byte("a/b/c"), blameRange: []byte{}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), diff --git a/internal/gitaly/service/commit/stats_test.go b/internal/gitaly/service/commit/stats_test.go index cce0d5d93..b572a1d0b 100644 --- a/internal/gitaly/service/commit/stats_test.go +++ b/internal/gitaly/service/commit/stats_test.go @@ -94,7 +94,7 @@ func TestCommitStatsFailure(t *testing.T) { { desc: "no repository provided", request: &gitalypb.CommitStatsRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -108,7 +108,7 @@ func TestCommitStatsFailure(t *testing.T) { }, Revision: []byte("test-do-not-touch"), }, - expectedErr: helper.ErrNotFoundf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrNotFoundf(testhelper.GitalyOrPraefectMessage( fmt.Sprintf("GetRepoPath: not a git repository: %q", filepath.Join(cfg.Storages[0].Path, "bar.git")), "accessor call: route repository accessor: consistent storages: repository \"default\"/\"bar.git\" not found", )), @@ -122,7 +122,7 @@ func TestCommitStatsFailure(t *testing.T) { }, Revision: []byte("test-do-not-touch"), }, - expectedErr: helper.ErrNotFoundf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrNotFoundf(testhelper.GitalyOrPraefectMessage( fmt.Sprintf("GetRepoPath: not a git repository: %q", filepath.Join(cfg.Storages[0].Path, "bar.git")), "accessor call: route repository accessor: consistent storages: repository \"default\"/\"bar.git\" not found", )), @@ -136,7 +136,7 @@ func TestCommitStatsFailure(t *testing.T) { }, Revision: []byte("test-do-not-touch"), }, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "GetStorageByName: no such storage: \"foo\"", "repo scoped: invalid Repository", )), diff --git a/internal/gitaly/service/commit/tree_entries_test.go b/internal/gitaly/service/commit/tree_entries_test.go index 261b5f638..8f9a1829d 100644 --- a/internal/gitaly/service/commit/tree_entries_test.go +++ b/internal/gitaly/service/commit/tree_entries_test.go @@ -707,7 +707,7 @@ func TestGetTreeEntries_validation(t *testing.T) { Revision: revision, Path: path, }, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "GetStorageByName: no such storage: \"fake\"", "repo scoped: invalid Repository", )), @@ -719,7 +719,7 @@ func TestGetTreeEntries_validation(t *testing.T) { Revision: revision, Path: path, }, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "TreeEntry: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/commit/tree_entry_test.go b/internal/gitaly/service/commit/tree_entry_test.go index 649c09f61..6217720f1 100644 --- a/internal/gitaly/service/commit/tree_entry_test.go +++ b/internal/gitaly/service/commit/tree_entry_test.go @@ -168,7 +168,7 @@ func TestFailedTreeEntry(t *testing.T) { { name: "Repository doesn't exist", req: &gitalypb.TreeEntryRequest{Repository: &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}, Revision: revision, Path: path}, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "GetStorageByName: no such storage: \"fake\"", "repo scoped: invalid Repository", )), @@ -176,7 +176,7 @@ func TestFailedTreeEntry(t *testing.T) { { name: "Repository is nil", req: &gitalypb.TreeEntryRequest{Repository: nil, Revision: revision, Path: path}, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "TreeEntry: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/conflicts/list_conflict_files_test.go b/internal/gitaly/service/conflicts/list_conflict_files_test.go index a64701786..e4eab1d84 100644 --- a/internal/gitaly/service/conflicts/list_conflict_files_test.go +++ b/internal/gitaly/service/conflicts/list_conflict_files_test.go @@ -340,7 +340,7 @@ func TestFailedListConflictFilesRequestDueToValidation(t *testing.T) { OurCommitOid: ourCommitOid, TheirCommitOid: theirCommitOid, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/conflicts/resolve_conflicts_test.go b/internal/gitaly/service/conflicts/resolve_conflicts_test.go index 1d31fb785..cc9edcd9d 100644 --- a/internal/gitaly/service/conflicts/resolve_conflicts_test.go +++ b/internal/gitaly/service/conflicts/resolve_conflicts_test.go @@ -692,7 +692,7 @@ func TestFailedResolveConflictsRequestDueToValidation(t *testing.T) { SourceBranch: sourceBranch, TargetBranch: targetBranch, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "ResolveConflicts: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/diff/commit_test.go b/internal/gitaly/service/diff/commit_test.go index 18edfa676..b787de992 100644 --- a/internal/gitaly/service/diff/commit_test.go +++ b/internal/gitaly/service/diff/commit_test.go @@ -805,7 +805,7 @@ func TestFailedCommitDiffRequestDueToValidationError(t *testing.T) { { desc: "Repository doesn't exist", req: &gitalypb.CommitDiffRequest{Repository: &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}, RightCommitId: rightCommit, LeftCommitId: leftCommit}, - exrErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + exrErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), @@ -813,7 +813,7 @@ func TestFailedCommitDiffRequestDueToValidationError(t *testing.T) { { desc: "Repository is nil", req: &gitalypb.CommitDiffRequest{Repository: nil, RightCommitId: rightCommit, LeftCommitId: leftCommit}, - exrErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + exrErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "CommitDiff: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/diff/numstat_test.go b/internal/gitaly/service/diff/numstat_test.go index 74764927b..82678529e 100644 --- a/internal/gitaly/service/diff/numstat_test.go +++ b/internal/gitaly/service/diff/numstat_test.go @@ -134,7 +134,7 @@ func TestFailedDiffStatsRequest(t *testing.T) { repo: nil, leftCommitID: "e4003da16c1c2c3fc4567700121b17bf8e591c6c", rightCommitID: "8a0f2ee90d940bfb0ba1e14e8214b0649056e4ab", - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -144,7 +144,7 @@ func TestFailedDiffStatsRequest(t *testing.T) { repo: &gitalypb.Repository{StorageName: repo.GetStorageName(), RelativePath: "bar.git"}, leftCommitID: "e4003da16c1c2c3fc4567700121b17bf8e591c6c", rightCommitID: "8a0f2ee90d940bfb0ba1e14e8214b0649056e4ab", - expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefectMessage( `GetRepoPath: not a git repository: "`+cfg.Storages[0].Path+`/bar.git"`, `accessor call: route repository accessor: consistent storages: repository "default"/"bar.git" not found`, )), @@ -154,7 +154,7 @@ func TestFailedDiffStatsRequest(t *testing.T) { repo: &gitalypb.Repository{StorageName: "foo", RelativePath: "bar.git"}, leftCommitID: "e4003da16c1c2c3fc4567700121b17bf8e591c6c", rightCommitID: "8a0f2ee90d940bfb0ba1e14e8214b0649056e4ab", - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "foo"`, "repo scoped: invalid Repository", )), diff --git a/internal/gitaly/service/objectpool/alternates_test.go b/internal/gitaly/service/objectpool/alternates_test.go index 69b123646..3420f2e10 100644 --- a/internal/gitaly/service/objectpool/alternates_test.go +++ b/internal/gitaly/service/objectpool/alternates_test.go @@ -219,7 +219,7 @@ func TestDisconnectGitAlternates_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.DisconnectGitAlternatesRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/objectpool/get_test.go b/internal/gitaly/service/objectpool/get_test.go index 7b22344ca..bd3125d77 100644 --- a/internal/gitaly/service/objectpool/get_test.go +++ b/internal/gitaly/service/objectpool/get_test.go @@ -82,7 +82,7 @@ func TestGetObjectPool_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.GetObjectPoolRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/operations/apply_patch_test.go b/internal/gitaly/service/operations/apply_patch_test.go index a765f1568..1639c2bae 100644 --- a/internal/gitaly/service/operations/apply_patch_test.go +++ b/internal/gitaly/service/operations/apply_patch_test.go @@ -711,7 +711,7 @@ func TestFailedValidationUserApplyPatch(t *testing.T) { desc: "missing Repository", branchName: "new-branch", user: gittest.TestUser, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "UserApplyPatch: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/operations/branches_test.go b/internal/gitaly/service/operations/branches_test.go index 2d3d26416..25f6a721d 100644 --- a/internal/gitaly/service/operations/branches_test.go +++ b/internal/gitaly/service/operations/branches_test.go @@ -354,7 +354,7 @@ func TestUserCreateBranch_Failure(t *testing.T) { branchName: "shiny-new-branch", startPoint: "", user: gittest.TestUser, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/operations/cherry_pick_test.go b/internal/gitaly/service/operations/cherry_pick_test.go index 09d3df584..b42c92f41 100644 --- a/internal/gitaly/service/operations/cherry_pick_test.go +++ b/internal/gitaly/service/operations/cherry_pick_test.go @@ -300,7 +300,7 @@ func TestServer_UserCherryPick_failedValidations(t *testing.T) { request: &gitalypb.UserCherryPickRequest{ Repository: nil, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "UserCherryPick: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/operations/commit_files_test.go b/internal/gitaly/service/operations/commit_files_test.go index 7973f31ae..adfbf5042 100644 --- a/internal/gitaly/service/operations/commit_files_test.go +++ b/internal/gitaly/service/operations/commit_files_test.go @@ -1485,7 +1485,7 @@ func TestFailedUserCommitFilesRequest(t *testing.T) { { desc: "empty Repository", req: headerRequest(nil, gittest.TestUser, branchName, commitFilesMessage, ""), - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "UserCommitFiles: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/operations/merge_test.go b/internal/gitaly/service/operations/merge_test.go index 5fbd57363..1ee05eb8b 100644 --- a/internal/gitaly/service/operations/merge_test.go +++ b/internal/gitaly/service/operations/merge_test.go @@ -142,7 +142,7 @@ func TestUserMergeBranch_failure(t *testing.T) { { desc: "no repository provided", repo: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/operations/rebase_test.go b/internal/gitaly/service/operations/rebase_test.go index 2f452c142..a1939f05e 100644 --- a/internal/gitaly/service/operations/rebase_test.go +++ b/internal/gitaly/service/operations/rebase_test.go @@ -785,7 +785,7 @@ func TestUserRebaseConfirmable_failedWithCode(t *testing.T) { buildHeaderRequest: func() *gitalypb.UserRebaseConfirmableRequest { return buildHeaderRequest(nil, gittest.TestUser, "1", rebaseBranchName, branchCommitID, nil, "master") }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "UserRebaseConfirmable: empty Repository", "repo scoped: empty Repository", )), @@ -798,7 +798,7 @@ func TestUserRebaseConfirmable_failedWithCode(t *testing.T) { return buildHeaderRequest(repo, gittest.TestUser, "1", rebaseBranchName, branchCommitID, repo, "master") }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `creating repo quarantine: creating object quarantine: getting repo path: GetStorageByName: no such storage: "@this-storage-does-not-exist"`, "repo scoped: invalid Repository", )), @@ -811,7 +811,7 @@ func TestUserRebaseConfirmable_failedWithCode(t *testing.T) { return buildHeaderRequest(repo, gittest.TestUser, "1", rebaseBranchName, branchCommitID, repo, "master") }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "creating repo quarantine: creating object quarantine: getting repo path: GetPath: relative path missing", "repo scoped: invalid Repository", )), diff --git a/internal/gitaly/service/operations/revert_test.go b/internal/gitaly/service/operations/revert_test.go index 1781bdd80..067e66f1f 100644 --- a/internal/gitaly/service/operations/revert_test.go +++ b/internal/gitaly/service/operations/revert_test.go @@ -380,7 +380,7 @@ func TestServer_UserRevert_failuedDueToValidations(t *testing.T) { request: &gitalypb.UserRevertRequest{ Repository: nil, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/operations/squash_test.go b/internal/gitaly/service/operations/squash_test.go index 74553e19d..f907eb8d7 100644 --- a/internal/gitaly/service/operations/squash_test.go +++ b/internal/gitaly/service/operations/squash_test.go @@ -538,7 +538,7 @@ func TestUserSquash_validation(t *testing.T) { StartSha: startSha, EndSha: endSha, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "UserSquash: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/operations/submodules_test.go b/internal/gitaly/service/operations/submodules_test.go index 1da25604a..1484dba73 100644 --- a/internal/gitaly/service/operations/submodules_test.go +++ b/internal/gitaly/service/operations/submodules_test.go @@ -209,7 +209,7 @@ func TestFailedUserUpdateSubmoduleRequestDueToValidations(t *testing.T) { Branch: []byte("some-branch"), CommitMessage: []byte("Update Submodule message"), }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "UserUpdateSubmodule: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/operations/tags_test.go b/internal/gitaly/service/operations/tags_test.go index 9ecf3c82b..d9006eee8 100644 --- a/internal/gitaly/service/operations/tags_test.go +++ b/internal/gitaly/service/operations/tags_test.go @@ -958,7 +958,7 @@ func TestUserDeleteTag_invalidArgument(t *testing.T) { request: &gitalypb.UserDeleteTagRequest{ Repository: nil, }, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -1181,7 +1181,7 @@ func TestUserCreateTag_invalidArgument(t *testing.T) { tagName: "shiny-new-tag", targetRevision: "main", user: gittest.TestUser, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "validating request: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/ref/branches_test.go b/internal/gitaly/service/ref/branches_test.go index 9074b5add..8e7c50e05 100644 --- a/internal/gitaly/service/ref/branches_test.go +++ b/internal/gitaly/service/ref/branches_test.go @@ -96,7 +96,7 @@ func TestFailedFindBranchRequest(t *testing.T) { { desc: "no repository provided", repo: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/ref/delete_refs_test.go b/internal/gitaly/service/ref/delete_refs_test.go index 85c344268..233346147 100644 --- a/internal/gitaly/service/ref/delete_refs_test.go +++ b/internal/gitaly/service/ref/delete_refs_test.go @@ -277,7 +277,7 @@ func TestDeleteRefs_validation(t *testing.T) { { desc: "no repository provided", request: &gitalypb.DeleteRefsRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "DeleteRefs: empty Repository", "repo scoped: empty Repository", )), @@ -288,7 +288,7 @@ func TestDeleteRefs_validation(t *testing.T) { Repository: &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}, ExceptWithPrefix: [][]byte{[]byte("exclude-this")}, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), @@ -299,7 +299,7 @@ func TestDeleteRefs_validation(t *testing.T) { Repository: nil, ExceptWithPrefix: [][]byte{[]byte("exclude-this")}, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "DeleteRefs: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/ref/find_all_tags_test.go b/internal/gitaly/service/ref/find_all_tags_test.go index cfe808c4a..09053f595 100644 --- a/internal/gitaly/service/ref/find_all_tags_test.go +++ b/internal/gitaly/service/ref/find_all_tags_test.go @@ -436,7 +436,7 @@ func TestFindAllTags_invalidRequest(t *testing.T) { { desc: "empty request", request: &gitalypb.FindAllTagsRequest{}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -449,7 +449,7 @@ func TestFindAllTags_invalidRequest(t *testing.T) { RelativePath: "repo", }, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `invalid git directory: GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), diff --git a/internal/gitaly/service/ref/find_refs_by_oid_test.go b/internal/gitaly/service/ref/find_refs_by_oid_test.go index ec29f71d5..ae88fadf5 100644 --- a/internal/gitaly/service/ref/find_refs_by_oid_test.go +++ b/internal/gitaly/service/ref/find_refs_by_oid_test.go @@ -228,7 +228,7 @@ func TestFindRefsByOID_validation(t *testing.T) { Repository: nil, Oid: "abcdefg", }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/ref/find_tag_test.go b/internal/gitaly/service/ref/find_tag_test.go index 741cddbe1..e023bf00c 100644 --- a/internal/gitaly/service/ref/find_tag_test.go +++ b/internal/gitaly/service/ref/find_tag_test.go @@ -301,7 +301,7 @@ func TestFindTag_invalidRequest(t *testing.T) { { desc: "empty request", request: &gitalypb.FindTagRequest{}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -314,7 +314,7 @@ func TestFindTag_invalidRequest(t *testing.T) { RelativePath: "repo", }, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `invalid git directory: GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), diff --git a/internal/gitaly/service/ref/list_refs_test.go b/internal/gitaly/service/ref/list_refs_test.go index 0a51b3c04..2879ed09b 100644 --- a/internal/gitaly/service/ref/list_refs_test.go +++ b/internal/gitaly/service/ref/list_refs_test.go @@ -215,7 +215,7 @@ func TestListRefs_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.ListRefsRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/ref/pack_refs_test.go b/internal/gitaly/service/ref/pack_refs_test.go index 70e14129c..267984ad3 100644 --- a/internal/gitaly/service/ref/pack_refs_test.go +++ b/internal/gitaly/service/ref/pack_refs_test.go @@ -82,7 +82,7 @@ func TestPackRefs_invalidRequest(t *testing.T) { { desc: "nil repo", repo: nil, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -90,7 +90,7 @@ func TestPackRefs_invalidRequest(t *testing.T) { { desc: "invalid storage name", repo: &gitalypb.Repository{StorageName: "foo"}, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "foo"`, "repo scoped: invalid Repository", )), @@ -100,7 +100,7 @@ func TestPackRefs_invalidRequest(t *testing.T) { repo: &gitalypb.Repository{StorageName: cfg.Storages[0].Name, RelativePath: "bar"}, err: status.Error( codes.NotFound, - testhelper.GitalyOrPraefect( + testhelper.GitalyOrPraefectMessage( fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path), `routing repository maintenance: getting repository metadata: repository not found`, ), diff --git a/internal/gitaly/service/ref/refexists_test.go b/internal/gitaly/service/ref/refexists_test.go index 7f6579ece..d56094ba3 100644 --- a/internal/gitaly/service/ref/refexists_test.go +++ b/internal/gitaly/service/ref/refexists_test.go @@ -76,7 +76,7 @@ func TestRefExists_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.RefExistsRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/ref/refs_test.go b/internal/gitaly/service/ref/refs_test.go index b43bc6d22..4a6aa4fd0 100644 --- a/internal/gitaly/service/ref/refs_test.go +++ b/internal/gitaly/service/ref/refs_test.go @@ -134,7 +134,7 @@ func TestFindAllBranchNames_validate(t *testing.T) { { desc: "repository not provided", repo: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -142,7 +142,7 @@ func TestFindAllBranchNames_validate(t *testing.T) { { desc: "repository doesn't exist on disk", repo: &gitalypb.Repository{StorageName: cfg.Storages[0].Name, RelativePath: "made/up/path"}, - expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefectMessage( `GetRepoPath: not a git repository: "`+cfg.Storages[0].Path+`/made/up/path"`, `accessor call: route repository accessor: consistent storages: repository "default"/"made/up/path" not found`, )), @@ -150,7 +150,7 @@ func TestFindAllBranchNames_validate(t *testing.T) { { desc: "unknown storage", repo: &gitalypb.Repository{StorageName: "invalid", RelativePath: repo.GetRelativePath()}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "invalid"`, "repo scoped: invalid Repository", )), @@ -201,7 +201,7 @@ func TestFindAllTagNames_validate(t *testing.T) { { desc: "repository not provided", repo: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -209,7 +209,7 @@ func TestFindAllTagNames_validate(t *testing.T) { { desc: "repository doesn't exist on disk", repo: &gitalypb.Repository{StorageName: cfg.Storages[0].Name, RelativePath: "made/up/path"}, - expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefectMessage( `GetRepoPath: not a git repository: "`+cfg.Storages[0].Path+`/made/up/path"`, `accessor call: route repository accessor: consistent storages: repository "default"/"made/up/path" not found`, )), @@ -217,7 +217,7 @@ func TestFindAllTagNames_validate(t *testing.T) { { desc: "unknown storage", repo: &gitalypb.Repository{StorageName: "invalid", RelativePath: repo.GetRelativePath()}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "invalid"`, "repo scoped: invalid Repository", )), @@ -279,7 +279,7 @@ func TestFindDefaultBranchName_validate(t *testing.T) { { desc: "repository not provided", repo: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -287,7 +287,7 @@ func TestFindDefaultBranchName_validate(t *testing.T) { { desc: "repository doesn't exist on disk", repo: &gitalypb.Repository{StorageName: cfg.Storages[0].Name, RelativePath: "made/up/path"}, - expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefectMessage( `GetRepoPath: not a git repository: "`+cfg.Storages[0].Path+`/made/up/path"`, `accessor call: route repository accessor: consistent storages: repository "default"/"made/up/path" not found`, )), @@ -295,7 +295,7 @@ func TestFindDefaultBranchName_validate(t *testing.T) { { desc: "unknown storage", repo: &gitalypb.Repository{StorageName: "invalid", RelativePath: repo.GetRelativePath()}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "invalid"`, "repo scoped: invalid Repository", )), @@ -562,7 +562,7 @@ func TestFindLocalBranches_validate(t *testing.T) { { desc: "repository not provided", repo: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -570,7 +570,7 @@ func TestFindLocalBranches_validate(t *testing.T) { { desc: "repository doesn't exist on disk", repo: &gitalypb.Repository{StorageName: cfg.Storages[0].Name, RelativePath: "made/up/path"}, - expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefectMessage( `GetRepoPath: not a git repository: "`+cfg.Storages[0].Path+`/made/up/path"`, `accessor call: route repository accessor: consistent storages: repository "default"/"made/up/path" not found`, )), @@ -578,7 +578,7 @@ func TestFindLocalBranches_validate(t *testing.T) { { desc: "unknown storage", repo: &gitalypb.Repository{StorageName: "invalid", RelativePath: repo.GetRelativePath()}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "invalid"`, "repo scoped: invalid Repository", )), @@ -740,7 +740,7 @@ func TestInvalidFindAllBranchesRequest(t *testing.T) { { description: "Empty request", request: &gitalypb.FindAllBranchesRequest{}, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -753,7 +753,7 @@ func TestInvalidFindAllBranchesRequest(t *testing.T) { RelativePath: "repo", }, }, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "GetStorageByName: no such storage: \"fake\"", "repo scoped: invalid Repository", )), @@ -869,7 +869,7 @@ func TestListTagNamesContainingCommit_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.ListTagNamesContainingCommitRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -987,7 +987,7 @@ func TestListBranchNamesContainingCommit_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.ListBranchNamesContainingCommitRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/ref/remote_branches_test.go b/internal/gitaly/service/ref/remote_branches_test.go index 09392ae1b..be2bb44cb 100644 --- a/internal/gitaly/service/ref/remote_branches_test.go +++ b/internal/gitaly/service/ref/remote_branches_test.go @@ -93,7 +93,7 @@ func TestInvalidFindAllRemoteBranchesRequest(t *testing.T) { }, RemoteName: "stub", }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), @@ -101,7 +101,7 @@ func TestInvalidFindAllRemoteBranchesRequest(t *testing.T) { { description: "Empty repo", request: &gitalypb.FindAllRemoteBranchesRequest{RemoteName: "myRemote"}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/ref/tag_messages_test.go b/internal/gitaly/service/ref/tag_messages_test.go index 6905aafc0..fa227973b 100644 --- a/internal/gitaly/service/ref/tag_messages_test.go +++ b/internal/gitaly/service/ref/tag_messages_test.go @@ -67,7 +67,7 @@ func TestFailedGetTagMessagesRequest(t *testing.T) { Repository: nil, TagIds: []string{"5937ac0a7beb003549fc5fd26fc247adbce4a52e"}, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "GetTagMessages: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/ref/tag_signatures_test.go b/internal/gitaly/service/ref/tag_signatures_test.go index b8c0aaa57..f7aa92481 100644 --- a/internal/gitaly/service/ref/tag_signatures_test.go +++ b/internal/gitaly/service/ref/tag_signatures_test.go @@ -194,7 +194,7 @@ func TestGetTagSignatures_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.GetTagSignaturesRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/remote/find_remote_root_ref_test.go b/internal/gitaly/service/remote/find_remote_root_ref_test.go index a147e1a25..151735210 100644 --- a/internal/gitaly/service/remote/find_remote_root_ref_test.go +++ b/internal/gitaly/service/remote/find_remote_root_ref_test.go @@ -92,7 +92,7 @@ func TestFindRemoteRootRefFailedDueToValidation(t *testing.T) { Repository: &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}, RemoteUrl: "remote-url", }, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), @@ -102,7 +102,7 @@ func TestFindRemoteRootRefFailedDueToValidation(t *testing.T) { request: &gitalypb.FindRemoteRootRefRequest{ RemoteUrl: "remote-url", }, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/remote/update_remote_mirror_test.go b/internal/gitaly/service/remote/update_remote_mirror_test.go index 2131e84d0..c6682fb04 100644 --- a/internal/gitaly/service/remote/update_remote_mirror_test.go +++ b/internal/gitaly/service/remote/update_remote_mirror_test.go @@ -912,7 +912,7 @@ func TestFailedUpdateRemoteMirrorRequestDueToValidation(t *testing.T) { Url: "something", }, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/repository/apply_gitattributes_test.go b/internal/gitaly/service/repository/apply_gitattributes_test.go index 21a3607d3..cd810aec6 100644 --- a/internal/gitaly/service/repository/apply_gitattributes_test.go +++ b/internal/gitaly/service/repository/apply_gitattributes_test.go @@ -217,7 +217,7 @@ func TestApplyGitattributesFailure(t *testing.T) { desc: "no repository provided", repo: nil, revision: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -226,7 +226,7 @@ func TestApplyGitattributesFailure(t *testing.T) { desc: "unknown storage provided", repo: &gitalypb.Repository{StorageName: "foo"}, revision: []byte("master"), - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "foo"`, "repo scoped: invalid Repository", )), @@ -235,7 +235,7 @@ func TestApplyGitattributesFailure(t *testing.T) { desc: "storage not provided", repo: &gitalypb.Repository{RelativePath: repo.GetRelativePath()}, revision: []byte("master"), - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: ""`, "repo scoped: invalid Repository", )), @@ -244,7 +244,7 @@ func TestApplyGitattributesFailure(t *testing.T) { desc: "repository doesn't exist on disk", repo: &gitalypb.Repository{StorageName: repo.GetStorageName(), RelativePath: "bar"}, revision: []byte("master"), - expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefectMessage( `GetRepoPath: not a git repository: "`+cfg.Storages[0].Path+`/bar"`, `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found`, )), diff --git a/internal/gitaly/service/repository/archive_test.go b/internal/gitaly/service/repository/archive_test.go index 0f2202c57..660554b8f 100644 --- a/internal/gitaly/service/repository/archive_test.go +++ b/internal/gitaly/service/repository/archive_test.go @@ -304,7 +304,7 @@ func TestGetArchive_inputValidation(t *testing.T) { prefix: "", commitID: commitID, format: gitalypb.GetArchiveRequest_ZIP, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), @@ -315,7 +315,7 @@ func TestGetArchive_inputValidation(t *testing.T) { prefix: "", commitID: commitID, format: gitalypb.GetArchiveRequest_ZIP, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -379,7 +379,7 @@ func TestGetArchive_inputValidation(t *testing.T) { commitID: "sadf", format: gitalypb.GetArchiveRequest_TAR, path: []byte("Here is a string...."), - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "GetPath: relative path missing", "repo scoped: invalid Repository", )), diff --git a/internal/gitaly/service/repository/backup_custom_hooks_test.go b/internal/gitaly/service/repository/backup_custom_hooks_test.go index 83fa58d71..0a4bda0a8 100644 --- a/internal/gitaly/service/repository/backup_custom_hooks_test.go +++ b/internal/gitaly/service/repository/backup_custom_hooks_test.go @@ -118,7 +118,7 @@ func TestBackupCustomHooks_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.BackupCustomHooksRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/repository/calculate_checksum_test.go b/internal/gitaly/service/repository/calculate_checksum_test.go index e181f313e..7924ead17 100644 --- a/internal/gitaly/service/repository/calculate_checksum_test.go +++ b/internal/gitaly/service/repository/calculate_checksum_test.go @@ -85,7 +85,7 @@ func TestFailedCalculateChecksum(t *testing.T) { { desc: "Invalid repository", request: &gitalypb.CalculateChecksumRequest{Repository: invalidRepo}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), @@ -93,7 +93,7 @@ func TestFailedCalculateChecksum(t *testing.T) { { desc: "Repository is nil", request: &gitalypb.CalculateChecksumRequest{}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/repository/cleanup_test.go b/internal/gitaly/service/repository/cleanup_test.go index 0a8ce336f..931b7379f 100644 --- a/internal/gitaly/service/repository/cleanup_test.go +++ b/internal/gitaly/service/repository/cleanup_test.go @@ -166,7 +166,7 @@ func TestCleanup_invalidRequest(t *testing.T) { }{ { desc: "no repository provided", - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -174,7 +174,7 @@ func TestCleanup_invalidRequest(t *testing.T) { { desc: "storage doesn't exist", in: &gitalypb.Repository{StorageName: "stub"}, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "stub"`, "repo scoped: invalid Repository", )), @@ -184,7 +184,7 @@ func TestCleanup_invalidRequest(t *testing.T) { in: &gitalypb.Repository{StorageName: cfg.Storages[0].Name, RelativePath: "so/me/some.git"}, err: status.Error( codes.NotFound, - testhelper.GitalyOrPraefect( + testhelper.GitalyOrPraefectMessage( fmt.Sprintf(`GetRepoPath: not a git repository: %q`, filepath.Join(cfg.Storages[0].Path, "so/me/some.git")), `routing repository maintenance: getting repository metadata: repository not found`, ), diff --git a/internal/gitaly/service/repository/config_test.go b/internal/gitaly/service/repository/config_test.go index 1ae0fa066..f50b34223 100644 --- a/internal/gitaly/service/repository/config_test.go +++ b/internal/gitaly/service/repository/config_test.go @@ -78,7 +78,7 @@ func TestGetConfig(t *testing.T) { t.Run("no repository provided", func(t *testing.T) { _, err := getConfig(t, client, nil) - msg := testhelper.GitalyOrPraefect("empty Repository", "repo scoped: empty Repository") + msg := testhelper.GitalyOrPraefectMessage("empty Repository", "repo scoped: empty Repository") expectedErr := status.Errorf(codes.InvalidArgument, msg) testhelper.RequireGrpcError(t, expectedErr, err) }) diff --git a/internal/gitaly/service/repository/create_bundle_from_ref_list_test.go b/internal/gitaly/service/repository/create_bundle_from_ref_list_test.go index 6653ad339..d6e821499 100644 --- a/internal/gitaly/service/repository/create_bundle_from_ref_list_test.go +++ b/internal/gitaly/service/repository/create_bundle_from_ref_list_test.go @@ -124,7 +124,7 @@ func TestCreateBundleFromRefList_validations(t *testing.T) { request: &gitalypb.CreateBundleFromRefListRequest{ Patterns: [][]byte{[]byte("master")}, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/repository/create_bundle_test.go b/internal/gitaly/service/repository/create_bundle_test.go index 9cc63d30c..802e247ac 100644 --- a/internal/gitaly/service/repository/create_bundle_test.go +++ b/internal/gitaly/service/repository/create_bundle_test.go @@ -75,7 +75,7 @@ func TestFailedCreateBundleRequestDueToValidations(t *testing.T) { { desc: "empty repository", request: &gitalypb.CreateBundleRequest{}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "CreateBundle: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/repository/create_fork_test.go b/internal/gitaly/service/repository/create_fork_test.go index d7899c785..e9767ee62 100644 --- a/internal/gitaly/service/repository/create_fork_test.go +++ b/internal/gitaly/service/repository/create_fork_test.go @@ -294,7 +294,7 @@ func TestCreateFork_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.CreateForkRequest{Repository: nil, SourceRepository: repo}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "CreateFork: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/repository/create_repository_from_bundle_test.go b/internal/gitaly/service/repository/create_repository_from_bundle_test.go index af09e5924..20b40c10d 100644 --- a/internal/gitaly/service/repository/create_repository_from_bundle_test.go +++ b/internal/gitaly/service/repository/create_repository_from_bundle_test.go @@ -253,7 +253,7 @@ func TestCreateRepositoryFromBundle_invalidArgument(t *testing.T) { require.NoError(t, stream.Send(&gitalypb.CreateRepositoryFromBundleRequest{})) _, err = stream.CloseAndRecv() - msg := testhelper.GitalyOrPraefect("CreateRepositoryFromBundle: empty Repository", "repo scoped: empty Repository") + msg := testhelper.GitalyOrPraefectMessage("CreateRepositoryFromBundle: empty Repository", "repo scoped: empty Repository") testhelper.RequireGrpcError(t, err, status.Error(codes.InvalidArgument, msg)) } diff --git a/internal/gitaly/service/repository/create_repository_from_snapshot_test.go b/internal/gitaly/service/repository/create_repository_from_snapshot_test.go index 86ba8f5a1..eae73c6fb 100644 --- a/internal/gitaly/service/repository/create_repository_from_snapshot_test.go +++ b/internal/gitaly/service/repository/create_repository_from_snapshot_test.go @@ -361,7 +361,7 @@ func TestServer_CreateRepositoryFromSnapshot_validate(t *testing.T) { { desc: "no repository provided", req: &gitalypb.CreateRepositoryFromSnapshotRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/repository/create_repository_from_url_test.go b/internal/gitaly/service/repository/create_repository_from_url_test.go index f2b717fdd..33bb78a25 100644 --- a/internal/gitaly/service/repository/create_repository_from_url_test.go +++ b/internal/gitaly/service/repository/create_repository_from_url_test.go @@ -345,7 +345,7 @@ func TestServer_CloneFromURLCommand_validate(t *testing.T) { { desc: "no repository provided", req: &gitalypb.CreateRepositoryFromURLRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "CreateRepositoryFromURL: empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/repository/create_repository_test.go b/internal/gitaly/service/repository/create_repository_test.go index 0eb5de28c..1063c56fa 100644 --- a/internal/gitaly/service/repository/create_repository_test.go +++ b/internal/gitaly/service/repository/create_repository_test.go @@ -161,14 +161,14 @@ func TestCreateRepository_invalidArguments(t *testing.T) { }{ { repo: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), }, { repo: &gitalypb.Repository{StorageName: "does not exist", RelativePath: "foobar.git"}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `creating repository: locate repository: GetStorageByName: no such storage: "does not exist"`, "repo scoped: invalid Repository", )), diff --git a/internal/gitaly/service/repository/fetch_bundle_test.go b/internal/gitaly/service/repository/fetch_bundle_test.go index d5df87904..ba11d469f 100644 --- a/internal/gitaly/service/repository/fetch_bundle_test.go +++ b/internal/gitaly/service/repository/fetch_bundle_test.go @@ -137,7 +137,7 @@ func TestServer_FetchBundle_validation(t *testing.T) { firstRequest: &gitalypb.FetchBundleRequest{ Repository: nil, }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -150,7 +150,7 @@ func TestServer_FetchBundle_validation(t *testing.T) { RelativePath: "unknown", }, }, - expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefectMessage( `GetRepoPath: not a git repository: "`+cfg.Storages[0].Path+`/unknown"`, `mutator call: route repository mutator: get repository id: repository "default"/"unknown" not found`, )), diff --git a/internal/gitaly/service/repository/fetch_test.go b/internal/gitaly/service/repository/fetch_test.go index acefd9547..a368543b8 100644 --- a/internal/gitaly/service/repository/fetch_test.go +++ b/internal/gitaly/service/repository/fetch_test.go @@ -156,7 +156,7 @@ func TestFetchSourceBranch_validate(t *testing.T) { { desc: "no repository provided", req: &gitalypb.FetchSourceBranchRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/repository/fsck_test.go b/internal/gitaly/service/repository/fsck_test.go index 8fddbb1f5..077e560bf 100644 --- a/internal/gitaly/service/repository/fsck_test.go +++ b/internal/gitaly/service/repository/fsck_test.go @@ -71,6 +71,6 @@ func TestFsck_validate(t *testing.T) { _, client := setupRepositoryServiceWithoutRepo(t) _, err := client.Fsck(ctx, &gitalypb.FsckRequest{Repository: nil}) - msg := testhelper.GitalyOrPraefect("empty Repository", "repo scoped: empty Repository") + msg := testhelper.GitalyOrPraefectMessage("empty Repository", "repo scoped: empty Repository") testhelper.RequireGrpcError(t, status.Error(codes.InvalidArgument, msg), err) } diff --git a/internal/gitaly/service/repository/gc_test.go b/internal/gitaly/service/repository/gc_test.go index 87944ce3d..3cc4a67ee 100644 --- a/internal/gitaly/service/repository/gc_test.go +++ b/internal/gitaly/service/repository/gc_test.go @@ -408,14 +408,14 @@ func TestGarbageCollectFailure(t *testing.T) { }{ { repo: nil, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), }, { repo: &gitalypb.Repository{StorageName: "foo"}, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "foo"`, "repo scoped: invalid Repository", )), @@ -424,7 +424,7 @@ func TestGarbageCollectFailure(t *testing.T) { repo: &gitalypb.Repository{StorageName: repo.StorageName, RelativePath: "bar"}, err: status.Error( codes.NotFound, - testhelper.GitalyOrPraefect( + testhelper.GitalyOrPraefectMessage( fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, storagePath), `routing repository maintenance: getting repository metadata: repository not found`, ), diff --git a/internal/gitaly/service/repository/info_attributes_test.go b/internal/gitaly/service/repository/info_attributes_test.go index eb1f2ea06..74b9a3be0 100644 --- a/internal/gitaly/service/repository/info_attributes_test.go +++ b/internal/gitaly/service/repository/info_attributes_test.go @@ -70,6 +70,6 @@ func TestGetInfoAttributes_validate(t *testing.T) { response, err := client.GetInfoAttributes(ctx, &gitalypb.GetInfoAttributesRequest{Repository: nil}) require.NoError(t, err) _, err = response.Recv() - msg := testhelper.GitalyOrPraefect("empty Repository", "repo scoped: empty Repository") + msg := testhelper.GitalyOrPraefectMessage("empty Repository", "repo scoped: empty Repository") testhelper.RequireGrpcError(t, status.Error(codes.InvalidArgument, msg), err) } diff --git a/internal/gitaly/service/repository/license_test.go b/internal/gitaly/service/repository/license_test.go index b3d679dfe..44e180f2d 100644 --- a/internal/gitaly/service/repository/license_test.go +++ b/internal/gitaly/service/repository/license_test.go @@ -199,6 +199,6 @@ func TestFindLicense_validate(t *testing.T) { client, serverSocketPath := runRepositoryService(t, cfg, nil) cfg.SocketPath = serverSocketPath _, err := client.FindLicense(ctx, &gitalypb.FindLicenseRequest{Repository: nil}) - msg := testhelper.GitalyOrPraefect("empty Repository", "repo scoped: empty Repository") + msg := testhelper.GitalyOrPraefectMessage("empty Repository", "repo scoped: empty Repository") testhelper.RequireGrpcError(t, status.Error(codes.InvalidArgument, msg), err) } diff --git a/internal/gitaly/service/repository/merge_base_test.go b/internal/gitaly/service/repository/merge_base_test.go index 43f26b956..e25ad3827 100644 --- a/internal/gitaly/service/repository/merge_base_test.go +++ b/internal/gitaly/service/repository/merge_base_test.go @@ -93,7 +93,7 @@ func TestFailedFindMergeBaseRequestDueToValidations(t *testing.T) { { desc: "no repository provided", req: &gitalypb.FindMergeBaseRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/repository/optimize_test.go b/internal/gitaly/service/repository/optimize_test.go index 79ec9b622..2ba184dbe 100644 --- a/internal/gitaly/service/repository/optimize_test.go +++ b/internal/gitaly/service/repository/optimize_test.go @@ -244,7 +244,7 @@ func TestOptimizeRepository_validation(t *testing.T) { { desc: "empty repository", request: &gitalypb.OptimizeRepositoryRequest{}, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -257,7 +257,7 @@ func TestOptimizeRepository_validation(t *testing.T) { RelativePath: repo.GetRelativePath(), }, }, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "non-existent"`, "repo scoped: invalid Repository"), ), @@ -270,7 +270,7 @@ func TestOptimizeRepository_validation(t *testing.T) { RelativePath: "path/not/exist", }, }, - expectedErr: helper.ErrNotFoundf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrNotFoundf(testhelper.GitalyOrPraefectMessage( fmt.Sprintf(`GetRepoPath: not a git repository: "%s/path/not/exist"`, cfg.Storages[0].Path), `routing repository maintenance: getting repository metadata: repository not found`, )), diff --git a/internal/gitaly/service/repository/raw_changes_test.go b/internal/gitaly/service/repository/raw_changes_test.go index 5079243c3..da1c3fdf2 100644 --- a/internal/gitaly/service/repository/raw_changes_test.go +++ b/internal/gitaly/service/repository/raw_changes_test.go @@ -184,7 +184,7 @@ func TestGetRawChangesFailures(t *testing.T) { FromRevision: "cfe32cf61b73a0d5e9f13e774abde7ff789b1660", ToRevision: "913c66a37b4a45b9769037c55c2d238bd0942d2e", }, - expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefect( + expectedErr: helper.ErrInvalidArgumentf(testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/repository/remove_test.go b/internal/gitaly/service/repository/remove_test.go index 8a784e6f4..2e7e80d1e 100644 --- a/internal/gitaly/service/repository/remove_test.go +++ b/internal/gitaly/service/repository/remove_test.go @@ -58,7 +58,7 @@ func TestRemoveRepository_validate(t *testing.T) { ctx := testhelper.Context(t) _, client := setupRepositoryServiceWithoutRepo(t) _, err := client.RemoveRepository(ctx, &gitalypb.RemoveRepositoryRequest{Repository: nil}) - testhelper.RequireGrpcError(t, status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + testhelper.RequireGrpcError(t, status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "missing repository", )), err) diff --git a/internal/gitaly/service/repository/rename_test.go b/internal/gitaly/service/repository/rename_test.go index eaab8bb16..12e8383d1 100644 --- a/internal/gitaly/service/repository/rename_test.go +++ b/internal/gitaly/service/repository/rename_test.go @@ -109,7 +109,7 @@ func TestRenameRepositoryInvalidRequest(t *testing.T) { { desc: "repository relative path doesn't exist", req: &gitalypb.RenameRepositoryRequest{Repository: &gitalypb.Repository{StorageName: repo.StorageName, RelativePath: "stub"}, RelativePath: "non-existent/directory"}, - exp: status.Error(codes.NotFound, fmt.Sprintf(`GetRepoPath: not a git repository: "%s/stub"`, testhelper.GitalyOrPraefect(storagePath, repo.GetStorageName()))), + exp: status.Error(codes.NotFound, fmt.Sprintf(`GetRepoPath: not a git repository: "%s/stub"`, testhelper.GitalyOrPraefectMessage(storagePath, repo.GetStorageName()))), }, } diff --git a/internal/gitaly/service/repository/repack_test.go b/internal/gitaly/service/repository/repack_test.go index 8ed6356cd..5e7c78df0 100644 --- a/internal/gitaly/service/repository/repack_test.go +++ b/internal/gitaly/service/repository/repack_test.go @@ -115,7 +115,7 @@ func TestRepackIncrementalFailure(t *testing.T) { { desc: "nil repo", repo: nil, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -123,7 +123,7 @@ func TestRepackIncrementalFailure(t *testing.T) { { desc: "invalid storage name", repo: &gitalypb.Repository{StorageName: "foo"}, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `repacking objects: GetStorageByName: no such storage: "foo"`, "repo scoped: invalid Repository", )), @@ -131,7 +131,7 @@ func TestRepackIncrementalFailure(t *testing.T) { { desc: "no storage name", repo: &gitalypb.Repository{RelativePath: "bar"}, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `repacking objects: GetStorageByName: no such storage: ""`, "repo scoped: invalid Repository", )), @@ -141,7 +141,7 @@ func TestRepackIncrementalFailure(t *testing.T) { repo: &gitalypb.Repository{StorageName: cfg.Storages[0].Name, RelativePath: "bar"}, err: status.Error( codes.NotFound, - testhelper.GitalyOrPraefect( + testhelper.GitalyOrPraefectMessage( fmt.Sprintf(`repacking objects: GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path), praefectErr, ), @@ -266,24 +266,24 @@ func TestRepackFullFailure(t *testing.T) { { desc: "nil repo", repo: nil, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect("empty Repository", "repo scoped: empty Repository")), + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage("empty Repository", "repo scoped: empty Repository")), }, { desc: "invalid storage name", repo: &gitalypb.Repository{StorageName: "foo"}, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect(`repacking objects: GetStorageByName: no such storage: "foo"`, "repo scoped: invalid Repository")), + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage(`repacking objects: GetStorageByName: no such storage: "foo"`, "repo scoped: invalid Repository")), }, { desc: "no storage name", repo: &gitalypb.Repository{RelativePath: "bar"}, - err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect(`repacking objects: GetStorageByName: no such storage: ""`, "repo scoped: invalid Repository")), + err: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage(`repacking objects: GetStorageByName: no such storage: ""`, "repo scoped: invalid Repository")), }, { desc: "non-existing repo", repo: &gitalypb.Repository{StorageName: cfg.Storages[0].Name, RelativePath: "bar"}, err: status.Error( codes.NotFound, - testhelper.GitalyOrPraefect( + testhelper.GitalyOrPraefectMessage( fmt.Sprintf(`repacking objects: GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path), praefectErr, ), diff --git a/internal/gitaly/service/repository/replicate_test.go b/internal/gitaly/service/repository/replicate_test.go index 99ab26dcb..fa4e9ae20 100644 --- a/internal/gitaly/service/repository/replicate_test.go +++ b/internal/gitaly/service/repository/replicate_test.go @@ -334,7 +334,7 @@ func TestReplicateRepositoryInvalidArguments(t *testing.T) { }, Source: nil, }, - expectedError: testhelper.GitalyOrPraefect( + expectedError: testhelper.GitalyOrPraefectMessage( "source repository cannot be empty", "repo scoped: invalid Repository", ), @@ -351,7 +351,7 @@ func TestReplicateRepositoryInvalidArguments(t *testing.T) { RelativePath: "/ab/cd/abcdef4321", }, }, - expectedError: testhelper.GitalyOrPraefect( + expectedError: testhelper.GitalyOrPraefectMessage( "both source and repository should have the same relative path", "repo scoped: invalid Repository", ), @@ -368,7 +368,7 @@ func TestReplicateRepositoryInvalidArguments(t *testing.T) { RelativePath: "/ab/cd/abcdef1234", }, }, - expectedError: testhelper.GitalyOrPraefect( + expectedError: testhelper.GitalyOrPraefectMessage( "repository and source have the same storage", "repo scoped: invalid Repository", ), diff --git a/internal/gitaly/service/repository/repository_test.go b/internal/gitaly/service/repository/repository_test.go index 42cc2b997..31154afd9 100644 --- a/internal/gitaly/service/repository/repository_test.go +++ b/internal/gitaly/service/repository/repository_test.go @@ -168,7 +168,7 @@ func TestFailedHasLocalBranches(t *testing.T) { { desc: "repository nil", repository: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -176,7 +176,7 @@ func TestFailedHasLocalBranches(t *testing.T) { { desc: "repository doesn't exist", repository: &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), diff --git a/internal/gitaly/service/repository/restore_custom_hooks_test.go b/internal/gitaly/service/repository/restore_custom_hooks_test.go index 0b5257dd7..35eb25e55 100644 --- a/internal/gitaly/service/repository/restore_custom_hooks_test.go +++ b/internal/gitaly/service/repository/restore_custom_hooks_test.go @@ -109,7 +109,7 @@ func testFailedRestoreCustomHooksDueToValidations(t *testing.T, ctx context.Cont require.NoError(t, stream.Send(&gitalypb.RestoreCustomHooksRequest{})) _, err = stream.CloseAndRecv() - testhelper.RequireGrpcError(t, err, status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + testhelper.RequireGrpcError(t, err, status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "RestoreCustomHooks: empty Repository", "repo scoped: empty Repository", ))) diff --git a/internal/gitaly/service/repository/size_test.go b/internal/gitaly/service/repository/size_test.go index 45c51bb99..2f4d24a6e 100644 --- a/internal/gitaly/service/repository/size_test.go +++ b/internal/gitaly/service/repository/size_test.go @@ -218,7 +218,7 @@ func testFailedRepositorySizeRequest(t *testing.T, ctx context.Context) { { description: "no repository provided", repo: nil, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/smarthttp/inforefs_test.go b/internal/gitaly/service/smarthttp/inforefs_test.go index 9574bb65a..f4242428a 100644 --- a/internal/gitaly/service/smarthttp/inforefs_test.go +++ b/internal/gitaly/service/smarthttp/inforefs_test.go @@ -144,7 +144,7 @@ func TestInfoRefsUploadPack_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.InfoRefsRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -155,7 +155,7 @@ func TestInfoRefsUploadPack_validate(t *testing.T) { StorageName: cfg.Storages[0].Name, RelativePath: "doesnt/exist", }}, - expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefectMessage( `GetRepoPath: not a git repository: "`+cfg.Storages[0].Path+`/doesnt/exist"`, `accessor call: route repository accessor: consistent storages: repository "default"/"doesnt/exist" not found`, )), @@ -357,7 +357,7 @@ func TestInfoRefsReceivePack_validate(t *testing.T) { { desc: "repository not provided", req: &gitalypb.InfoRefsRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), @@ -368,7 +368,7 @@ func TestInfoRefsReceivePack_validate(t *testing.T) { StorageName: cfg.Storages[0].Name, RelativePath: "testdata/scratch/another_repo", }}, - expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.NotFound, testhelper.GitalyOrPraefectMessage( `GetRepoPath: not a git repository: "`+cfg.Storages[0].Path+`/testdata/scratch/another_repo"`, `accessor call: route repository accessor: consistent storages: repository "default"/"testdata/scratch/another_repo" not found`, )), diff --git a/internal/gitaly/service/smarthttp/receive_pack_test.go b/internal/gitaly/service/smarthttp/receive_pack_test.go index d7b066969..5059e4c7c 100644 --- a/internal/gitaly/service/smarthttp/receive_pack_test.go +++ b/internal/gitaly/service/smarthttp/receive_pack_test.go @@ -378,7 +378,7 @@ func TestPostReceivePack_requestValidation(t *testing.T) { }, GlId: "user-123", }, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), @@ -386,7 +386,7 @@ func TestPostReceivePack_requestValidation(t *testing.T) { { desc: "Repository is nil", request: &gitalypb.PostReceivePackRequest{Repository: nil, GlId: "user-123"}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/smarthttp/upload_pack_test.go b/internal/gitaly/service/smarthttp/upload_pack_test.go index 398a5df8c..84aa96332 100644 --- a/internal/gitaly/service/smarthttp/upload_pack_test.go +++ b/internal/gitaly/service/smarthttp/upload_pack_test.go @@ -386,7 +386,7 @@ func testServerPostUploadPackWithSideChannelValidation(t *testing.T, ctx context { desc: "Repository doesn't exist", req: &gitalypb.PostUploadPackRequest{Repository: &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( `GetStorageByName: no such storage: "fake"`, "repo scoped: invalid Repository", )), @@ -394,7 +394,7 @@ func testServerPostUploadPackWithSideChannelValidation(t *testing.T, ctx context { desc: "Repository no provided", req: &gitalypb.PostUploadPackRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/gitaly/service/ssh/upload_archive_test.go b/internal/gitaly/service/ssh/upload_archive_test.go index d46b814a2..a66c50a95 100644 --- a/internal/gitaly/service/ssh/upload_archive_test.go +++ b/internal/gitaly/service/ssh/upload_archive_test.go @@ -74,7 +74,7 @@ func TestFailedUploadArchiveRequestDueToValidationError(t *testing.T) { { Desc: "Repository.RelativePath is empty", Req: &gitalypb.SSHUploadArchiveRequest{Repository: &gitalypb.Repository{StorageName: cfg.Storages[0].Name, RelativePath: ""}}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "GetPath: relative path missing", "repo scoped: invalid Repository", )), @@ -82,7 +82,7 @@ func TestFailedUploadArchiveRequestDueToValidationError(t *testing.T) { { Desc: "Repository is nil", Req: &gitalypb.SSHUploadArchiveRequest{Repository: nil}, - expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( + expectedErr: status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefectMessage( "empty Repository", "repo scoped: empty Repository", )), diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go index fc19d98a9..dfcb757fe 100644 --- a/internal/testhelper/testhelper.go +++ b/internal/testhelper/testhelper.go @@ -373,9 +373,9 @@ func GenerateCerts(tb testing.TB) (string, string) { return certFile.Name(), keyFile.Name() } -// GitalyOrPraefect returns gitalyMsg if GITALY_TEST_WITH_PRAEFECT env var is not set and +// GitalyOrPraefectMessage returns gitalyMsg if GITALY_TEST_WITH_PRAEFECT env var is not set and // praefectMsg otherwise. -func GitalyOrPraefect(gitalyMsg, praefectMsg string) string { +func GitalyOrPraefectMessage(gitalyMsg, praefectMsg string) string { if IsPraefectEnabled() { return praefectMsg } |