diff options
author | James Fargher <jfargher@gitlab.com> | 2021-07-06 02:26:13 +0300 |
---|---|---|
committer | James Fargher <jfargher@gitlab.com> | 2021-07-13 02:04:39 +0300 |
commit | ffbd9a31098827ef404c4272e0f07891b5eeb402 (patch) | |
tree | 0ec6735b49ad9f115313952339f2a4a5548c7995 | |
parent | a8d42fb628ab8d4cbde0481d25724963f73e7931 (diff) |
Remove feature gitaly_fetch_internal_remote_errors
Since FetchInternalRemote has been inlined into ReplicateRepository we
no longer need to make this RPC errors more verbose.
4 files changed, 5 insertions, 19 deletions
diff --git a/internal/gitaly/service/remote/fetch_internal_remote.go b/internal/gitaly/service/remote/fetch_internal_remote.go index 71fb457d8..256471391 100644 --- a/internal/gitaly/service/remote/fetch_internal_remote.go +++ b/internal/gitaly/service/remote/fetch_internal_remote.go @@ -14,7 +14,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/ref" "gitlab.com/gitlab-org/gitaly/v14/internal/gitalyssh" "gitlab.com/gitlab-org/gitaly/v14/internal/helper" - "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -107,7 +106,7 @@ func (s *server) FetchInternalRemote(ctx context.Context, req *gitalypb.FetchInt if err := FetchInternalRemote(ctx, s.cfg, s.conns, repo, req.RemoteRepository); err != nil { var fetchErr fetchFailedError - if featureflag.FetchInternalRemoteErrors.IsDisabled(ctx) && errors.As(err, &fetchErr) { + if errors.As(err, &fetchErr) { // Design quirk: if the fetch fails, this RPC returns Result: false, but no error. ctxlogrus.Extract(ctx).WithError(fetchErr.err).WithField("stderr", fetchErr.stderr).Warn("git fetch failed") return &gitalypb.FetchInternalRemoteResponse{Result: false}, nil diff --git a/internal/gitaly/service/remote/fetch_internal_remote_test.go b/internal/gitaly/service/remote/fetch_internal_remote_test.go index 4e51f641a..35ec8e25c 100644 --- a/internal/gitaly/service/remote/fetch_internal_remote_test.go +++ b/internal/gitaly/service/remote/fetch_internal_remote_test.go @@ -21,7 +21,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/ref" "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/ssh" "gitlab.com/gitlab-org/gitaly/v14/internal/helper" - "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver" @@ -250,18 +249,9 @@ func TestFailedFetchInternalRemote(t *testing.T) { RemoteRepository: remoteRepo, } - t.Run("fetch_internal_remote_errors enabled", func(t *testing.T) { - _, err := client.FetchInternalRemote(ctx, request) - require.Error(t, err, "FetchInternalRemote is supposed to return an error when 'git fetch' fails") - }) - - t.Run("fetch_internal_remote_errors disabled", func(t *testing.T) { - ctx := featureflag.OutgoingCtxWithDisabledFeatureFlags(ctx, featureflag.FetchInternalRemoteErrors) - - c, err := client.FetchInternalRemote(ctx, request) - require.NoError(t, err, "FetchInternalRemote is not supposed to return an error when 'git fetch' fails") - require.False(t, c.GetResult()) - }) + c, err := client.FetchInternalRemote(ctx, request) + require.NoError(t, err, "FetchInternalRemote is not supposed to return an error when 'git fetch' fails") + require.False(t, c.GetResult()) } func TestFailedFetchInternalRemoteDueToValidations(t *testing.T) { diff --git a/internal/gitaly/service/repository/replicate_test.go b/internal/gitaly/service/repository/replicate_test.go index eb5f424bd..a89228393 100644 --- a/internal/gitaly/service/repository/replicate_test.go +++ b/internal/gitaly/service/repository/replicate_test.go @@ -177,7 +177,7 @@ func testReplicateRepositoryTransactional(t *testing.T, ctx context.Context) { // connection is not to Praefect but to Gitaly now, it's trying to cast votes on a // non-multiplexed Gitaly connection instead of against the expected Praefect peer. require.Error(t, err) - require.Contains(t, err.Error(), "ref updates aborted by hook") + require.Contains(t, err.Error(), "FetchInternalRemote failed") require.Equal(t, 0, votes) } } diff --git a/internal/metadata/featureflag/feature_flags.go b/internal/metadata/featureflag/feature_flags.go index 148d18014..8b9175f66 100644 --- a/internal/metadata/featureflag/feature_flags.go +++ b/internal/metadata/featureflag/feature_flags.go @@ -6,8 +6,6 @@ package featureflag var ( // GoUpdateRemoteMirror enables the Go implementation of UpdateRemoteMirror GoUpdateRemoteMirror = FeatureFlag{Name: "go_update_remote_mirror", OnByDefault: true} - // FetchInternalRemoteErrors makes FetchInternalRemote return actual errors instead of a boolean - FetchInternalRemoteErrors = FeatureFlag{Name: "fetch_internal_remote_errors", OnByDefault: false} // LFSPointersPipeline enables the alternative pipeline implementation of LFS-pointer // related RPCs. LFSPointersPipeline = FeatureFlag{Name: "lfs_pointers_pipeline", OnByDefault: true} @@ -31,7 +29,6 @@ var ( // All includes all feature flags. var All = []FeatureFlag{ GoUpdateRemoteMirror, - FetchInternalRemoteErrors, LFSPointersPipeline, GoSetConfig, CreateRepositoryFromBundleAtomicFetch, |