diff options
Diffstat (limited to 'internal/gitaly/service/ref/pack_refs_test.go')
-rw-r--r-- | internal/gitaly/service/ref/pack_refs_test.go | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/internal/gitaly/service/ref/pack_refs_test.go b/internal/gitaly/service/ref/pack_refs_test.go index f16aa8175..e6da2b733 100644 --- a/internal/gitaly/service/ref/pack_refs_test.go +++ b/internal/gitaly/service/ref/pack_refs_test.go @@ -2,6 +2,7 @@ package ref import ( "bufio" + "context" "fmt" "os" "path/filepath" @@ -13,6 +14,7 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/git" "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/v14/internal/git/localrepo" + "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -20,7 +22,12 @@ import ( ) func TestPackRefsSuccessfulRequest(t *testing.T) { - ctx := testhelper.Context(t) + t.Parallel() + testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testPackRefsSuccessfulRequest) +} + +func testPackRefsSuccessfulRequest(t *testing.T, ctx context.Context) { + t.Parallel() cfg, repoProto, repoPath, client := setupRefService(ctx, t) @@ -67,9 +74,19 @@ func linesInPackfile(t *testing.T, repoPath string) int { func TestPackRefs_invalidRequest(t *testing.T) { t.Parallel() + testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testPackRefsInvalidRequest) +} + +func testPackRefsInvalidRequest(t *testing.T, ctx context.Context) { + t.Parallel() cfg, client := setupRefServiceWithoutRepo(t) + praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found` + if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) { + praefectErr = `routing repository maintenance: getting repository metadata: repository not found` + } + tests := []struct { repo *gitalypb.Repository err error @@ -92,7 +109,7 @@ func TestPackRefs_invalidRequest(t *testing.T) { codes.NotFound, gitalyOrPraefect( fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path), - `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found`, + praefectErr, ), ), }, @@ -100,7 +117,6 @@ func TestPackRefs_invalidRequest(t *testing.T) { for _, tc := range tests { t.Run(tc.desc, func(t *testing.T) { - ctx := testhelper.Context(t) //nolint:staticcheck _, err := client.PackRefs(ctx, &gitalypb.PackRefsRequest{Repository: tc.repo}) testhelper.RequireGrpcError(t, err, tc.err) |