diff --git a/internal/gitaly/service/ref/find_tag.go b/internal/gitaly/service/ref/find_tag.go index b23b50b3e10319b2b56f61fe1e5a83985a33385b..a96e9db780a2174f7daefe26f02bd75fb2d8a6e8 100644 --- a/internal/gitaly/service/ref/find_tag.go +++ b/internal/gitaly/service/ref/find_tag.go @@ -10,7 +10,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v15/internal/git" "gitlab.com/gitlab-org/gitaly/v15/internal/git/catfile" "gitlab.com/gitlab-org/gitaly/v15/internal/helper" - "gitlab.com/gitlab-org/gitaly/v15/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb" ) @@ -95,25 +94,21 @@ func (s *server) findTag(ctx context.Context, repo git.RepositoryExecutor, tagNa return nil, err } } else { - if featureflag.FindTagStructuredError.IsEnabled(ctx) { - detailedErr, err := helper.ErrWithDetails( - helper.ErrNotFoundf("tag does not exist"), - &gitalypb.FindTagError{ - Error: &gitalypb.FindTagError_TagNotFound{ - TagNotFound: &gitalypb.ReferenceNotFoundError{ - ReferenceName: []byte(fmt.Sprintf("refs/tags/%s", tagName)), - }, + detailedErr, err := helper.ErrWithDetails( + helper.ErrNotFoundf("tag does not exist"), + &gitalypb.FindTagError{ + Error: &gitalypb.FindTagError_TagNotFound{ + TagNotFound: &gitalypb.ReferenceNotFoundError{ + ReferenceName: []byte(fmt.Sprintf("refs/tags/%s", tagName)), }, }, - ) - if err != nil { - return nil, helper.ErrInternalf("generating detailed error: %w", err) - } - - return nil, detailedErr + }, + ) + if err != nil { + return nil, helper.ErrInternalf("generating detailed error: %w", err) } - return nil, errors.New("no tag found") + return nil, detailedErr } if err = tagCmd.Wait(); err != nil { diff --git a/internal/gitaly/service/ref/find_tag_test.go b/internal/gitaly/service/ref/find_tag_test.go index aeeaf9c56415ed8aeb846add62b1376f754acfdf..9baebb4e37f5d6d5e6acd5be66a112090e915fad 100644 --- a/internal/gitaly/service/ref/find_tag_test.go +++ b/internal/gitaly/service/ref/find_tag_test.go @@ -3,7 +3,6 @@ package ref import ( - "context" "fmt" "strings" "testing" @@ -15,7 +14,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo" "gitlab.com/gitlab-org/gitaly/v15/internal/git/updateref" "gitlab.com/gitlab-org/gitaly/v15/internal/helper" - "gitlab.com/gitlab-org/gitaly/v15/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v15/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -263,12 +261,8 @@ func TestFindTag_nestedTag(t *testing.T) { func TestFindTag_notFound(t *testing.T) { t.Parallel() - testhelper.NewFeatureSets(featureflag.FindTagStructuredError).Run(t, testFindTagNotFound) -} - -func testFindTagNotFound(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) cfg, client := setupRefServiceWithoutRepo(t) repoProto, _ := gittest.CreateRepository(ctx, t, cfg) @@ -277,23 +271,19 @@ func testFindTagNotFound(t *testing.T, ctx context.Context) { TagName: []byte("does-not-exist"), }) require.Nil(t, response) - if featureflag.FindTagStructuredError.IsEnabled(ctx) { - expectedErr, errGeneratingDetails := helper.ErrWithDetails( - helper.ErrNotFoundf("tag does not exist"), - &gitalypb.FindTagError{ - Error: &gitalypb.FindTagError_TagNotFound{ - TagNotFound: &gitalypb.ReferenceNotFoundError{ - ReferenceName: []byte("refs/tags/does-not-exist"), - }, + + expectedErr, errGeneratingDetails := helper.ErrWithDetails( + helper.ErrNotFoundf("tag does not exist"), + &gitalypb.FindTagError{ + Error: &gitalypb.FindTagError_TagNotFound{ + TagNotFound: &gitalypb.ReferenceNotFoundError{ + ReferenceName: []byte("refs/tags/does-not-exist"), }, }, - ) - require.NoError(t, errGeneratingDetails) - - testhelper.RequireGrpcError(t, expectedErr, err) - } else { - testhelper.RequireGrpcError(t, helper.ErrInternalf("no tag found"), err) - } + }, + ) + require.NoError(t, errGeneratingDetails) + testhelper.RequireGrpcError(t, expectedErr, err) } func TestFindTag_invalidRequest(t *testing.T) { diff --git a/internal/metadata/featureflag/ff_find_tag_structured_error.go b/internal/metadata/featureflag/ff_find_tag_structured_error.go deleted file mode 100644 index 900f1eefc7244da615ec9b3f877e4fb2de641233..0000000000000000000000000000000000000000 --- a/internal/metadata/featureflag/ff_find_tag_structured_error.go +++ /dev/null @@ -1,10 +0,0 @@ -package featureflag - -// FindTagStructuredError enables the use of structured errors for the FindTag RPC in case the tag -// could not be found. -var FindTagStructuredError = NewFeatureFlag( - "find_tag_structured_error", - "v15.3.0", - "https://gitlab.com/gitlab-org/gitaly/-/issues/4398", - false, -)