diff options
author | Karthik Nayak <knayak@gitlab.com> | 2023-01-16 19:55:43 +0300 |
---|---|---|
committer | Karthik Nayak <knayak@gitlab.com> | 2023-02-20 12:47:24 +0300 |
commit | 5992d3b5c0b2866f455593985cd46b2ecfd0e855 (patch) | |
tree | 12045caf22ecc08ba423a3776c1607e08ddb7d7f /internal | |
parent | 1ffa28f9b138d0ec7ce3534b09509a8594940a51 (diff) |
featureflag: Remove `FetchSourceBranchQuarantined`
The flag `FetchSourceBranchQuarantined` is rolled out, now we can delete
the flag and modify the code/tests to remove the previous logic.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/gitaly/service/repository/fetch.go | 23 | ||||
-rw-r--r-- | internal/gitaly/service/repository/fetch_test.go | 17 |
2 files changed, 9 insertions, 31 deletions
diff --git a/internal/gitaly/service/repository/fetch.go b/internal/gitaly/service/repository/fetch.go index a411fff8d..96b207892 100644 --- a/internal/gitaly/service/repository/fetch.go +++ b/internal/gitaly/service/repository/fetch.go @@ -7,11 +7,9 @@ import ( "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus" "gitlab.com/gitlab-org/gitaly/v15/internal/git" "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo" - "gitlab.com/gitlab-org/gitaly/v15/internal/git/quarantine" "gitlab.com/gitlab-org/gitaly/v15/internal/git/remoterepo" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/service" "gitlab.com/gitlab-org/gitaly/v15/internal/helper" - "gitlab.com/gitlab-org/gitaly/v15/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v15/internal/structerr" "gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb" ) @@ -34,17 +32,9 @@ func (s *server) FetchSourceBranch(ctx context.Context, req *gitalypb.FetchSourc return nil, structerr.NewInvalidArgument("%w", err) } - origTargetRepo := s.localrepo(req.GetRepository()) - targetRepo := origTargetRepo - - var quarantineDir *quarantine.Dir - if featureflag.FetchSourceBranchQuarantined.IsEnabled(ctx) { - var err error - - quarantineDir, targetRepo, err = s.quarantinedRepo(ctx, req.GetRepository()) - if err != nil { - return nil, err - } + quarantineDir, targetRepo, err := s.quarantinedRepo(ctx, req.GetRepository()) + if err != nil { + return nil, err } sourceRepo, err := remoterepo.New(ctx, req.GetSourceRepository(), s.conns) @@ -112,12 +102,11 @@ func (s *server) FetchSourceBranch(ctx context.Context, req *gitalypb.FetchSourc } } - if quarantineDir != nil { - if err := quarantineDir.Migrate(); err != nil { - return nil, structerr.NewInternal("migrating quarantined objects: %w", err) - } + if err := quarantineDir.Migrate(); err != nil { + return nil, structerr.NewInternal("migrating quarantined objects: %w", err) } + origTargetRepo := s.localrepo(req.GetRepository()) if err := origTargetRepo.UpdateRef(ctx, git.ReferenceName(req.GetTargetRef()), sourceOid, ""); err != nil { return nil, err } diff --git a/internal/gitaly/service/repository/fetch_test.go b/internal/gitaly/service/repository/fetch_test.go index f976036d7..73159fd1a 100644 --- a/internal/gitaly/service/repository/fetch_test.go +++ b/internal/gitaly/service/repository/fetch_test.go @@ -3,7 +3,6 @@ package repository import ( - "context" "fmt" "testing" @@ -12,7 +11,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v15/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config" - "gitlab.com/gitlab-org/gitaly/v15/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v15/internal/structerr" "gitlab.com/gitlab-org/gitaly/v15/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v15/internal/testhelper/testcfg" @@ -22,12 +20,7 @@ import ( func TestFetchSourceBranch(t *testing.T) { t.Parallel() - - testhelper.NewFeatureSets(featureflag.FetchSourceBranchQuarantined).Run(t, testFetchSourceBranch) -} - -func testFetchSourceBranch(t *testing.T, ctx context.Context) { - t.Parallel() + ctx := testhelper.Context(t) type setupData struct { cfg config.Cfg @@ -411,11 +404,7 @@ func testFetchSourceBranch(t *testing.T, ctx context.Context) { repo := localrepo.NewTestRepo(t, cfg, repoProto) exists, err := repo.HasRevision(ctx, commitID.Revision()+"^{commit}") require.NoError(t, err) - if featureflag.FetchSourceBranchQuarantined.IsEnabled(ctx) { - require.False(t, exists, "fetched commit isn't discarded") - } else { - require.True(t, exists, "fetched commit is discarded") - } + require.False(t, exists, "fetched commit isn't discarded") }, } }, @@ -428,7 +417,7 @@ func testFetchSourceBranch(t *testing.T, ctx context.Context) { data := tc.setup(t) md := testcfg.GitalyServersMetadataFromCfg(t, data.cfg) - ctx := testhelper.MergeOutgoingMetadata(ctx, md) + ctx = testhelper.MergeOutgoingMetadata(ctx, md) resp, err := data.client.FetchSourceBranch(ctx, data.request) testhelper.RequireGrpcError(t, tc.expectedErr, err) |