diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2022-01-20 13:09:54 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2022-02-01 12:28:01 +0300 |
commit | c10ada374ad2e6336b5c3042b033bcb2d51c5077 (patch) | |
tree | 82fa11491509b99529310231bfd867cb3ab1872d | |
parent | d23d2a076d5fbcde43d7c176f1b27d63b39ea27b (diff) |
Create test repository via API in TestUserApplyPatch
This commit creates the test repository via API in TestUserApplyPatch.
This change uncovered a small behavior difference in Praefect and Gitaly.
Now that Praefect is not using the metadata creation hack anymore, we can
see that Praefect's error message for non-existent repositories deviates
from Gitaly's. This is left as is since its been like this for a while
already with no apparent problems.
-rw-r--r-- | internal/gitaly/service/operations/apply_patch_test.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/internal/gitaly/service/operations/apply_patch_test.go b/internal/gitaly/service/operations/apply_patch_test.go index a1ec0dc41..c522c8c84 100644 --- a/internal/gitaly/service/operations/apply_patch_test.go +++ b/internal/gitaly/service/operations/apply_patch_test.go @@ -35,7 +35,7 @@ func TestUserApplyPatch(t *testing.T) { ctx := testhelper.Context(t) - ctx, cfg, _, _, client := setupOperationsService(t, ctx) + ctx, cfg, _, _, client := setupOperationsService(t, ctx, testserver.WithDisableMetadataForceCreation()) type actionFunc func(testing.TB, *localrepo.Repo) git2go.Action @@ -110,7 +110,13 @@ To restore the original branch and stop patching, run "git am --abort". desc: "non-existent repository", targetBranch: "master", nonExistentRepository: true, - error: status.Errorf(codes.NotFound, "GetRepoPath: not a git repository: \"%s/%s\"", cfg.Storages[0].Path, "doesnt-exist"), + error: func() error { + if testhelper.IsPraefectEnabled() { + return status.Errorf(codes.NotFound, "mutator call: route repository mutator: get repository id: repository %q/%q not found", cfg.Storages[0].Name, "doesnt-exist") + } + + return status.Errorf(codes.NotFound, "GetRepoPath: not a git repository: \"%s/%s\"", cfg.Storages[0].Path, "doesnt-exist") + }(), }, { desc: "creating the first branch does not work", @@ -269,7 +275,7 @@ To restore the original branch and stop patching, run "git am --abort". }, } { t.Run(tc.desc, func(t *testing.T) { - repoPb, repoPath := gittest.InitRepo(t, cfg, cfg.Storages[0]) + repoPb, repoPath := gittest.CreateRepository(ctx, t, cfg) repo := localrepo.NewTestRepo(t, cfg, repoPb) |