diff --git a/cmd/gitaly-hooks/hooks_test.go b/cmd/gitaly-hooks/hooks_test.go index f4f1ed5a6aa7b5e5e92d7d09c5a63c4e708aec2a..6a2a9cdbd74b7c7755f8e2a544d8ab0a60cf15f7 100644 --- a/cmd/gitaly-hooks/hooks_test.go +++ b/cmd/gitaly-hooks/hooks_test.go @@ -220,26 +220,15 @@ func TestHooksUpdate(t *testing.T) { socket, stop := runHookServiceServer(t, token) defer stop() - featureSets, err := testhelper.NewFeatureSets([]string{featureflag.GoUpdateHook}) - require.NoError(t, err) - - for _, featureSet := range featureSets { - t.Run(fmt.Sprintf("enabled features: %v", featureSet), func(t *testing.T) { - if featureSet.IsEnabled("use_gitaly_gitlabshell_config") { - config.Config.Hooks.CustomHooksDir = customHooksDir - } - - testHooksUpdate(t, tempGitlabShellDir, socket, token, testhelper.GlHookValues{ - GLID: glID, - GLUsername: glUsername, - GLRepo: glRepository, - GLProtocol: glProtocol, - }, featureSet) - }) - } + testHooksUpdate(t, tempGitlabShellDir, socket, token, testhelper.GlHookValues{ + GLID: glID, + GLUsername: glUsername, + GLRepo: glRepository, + GLProtocol: glProtocol, + }) } -func testHooksUpdate(t *testing.T, gitlabShellDir, socket, token string, glValues testhelper.GlHookValues, features testhelper.FeatureSet) { +func testHooksUpdate(t *testing.T, gitlabShellDir, socket, token string, glValues testhelper.GlHookValues) { defer func(cfg config.Cfg) { config.Config = cfg }(config.Config) @@ -273,9 +262,7 @@ open('%s', 'w') { |f| f.puts(JSON.dump(ARGV)) } var stdout, stderr bytes.Buffer - if features.IsEnabled(featureflag.GoUpdateHook) { - cmd.Env = append(cmd.Env, fmt.Sprintf("%s=true", featureflag.GoUpdateHookEnvVar)) - } + cmd.Env = append(cmd.Env, fmt.Sprintf("%s=true", featureflag.GoUpdateHookEnvVar)) cmd.Stdout = &stdout cmd.Stderr = &stderr cmd.Dir = testRepoPath diff --git a/internal/git/receivepack.go b/internal/git/receivepack.go index 6e27a5b58a2f484c23f892900d0b2e57e7c0f5c7..ab95a4de78953e323411f34662036494a52eab95 100644 --- a/internal/git/receivepack.go +++ b/internal/git/receivepack.go @@ -46,7 +46,7 @@ func ReceivePackHookEnv(ctx context.Context, req ReceivePackRequest) ([]string, fmt.Sprintf("GITALY_SOCKET=" + config.GitalyInternalSocketPath()), fmt.Sprintf("GITALY_REPO=%s", repo), fmt.Sprintf("GITALY_TOKEN=%s", config.Config.Auth.Token), - fmt.Sprintf("%s=%s", featureflag.GoUpdateHookEnvVar, strconv.FormatBool(featureflag.IsEnabled(ctx, featureflag.GoUpdateHook))), + fmt.Sprintf("%s=%s", featureflag.GoUpdateHookEnvVar, strconv.FormatBool(!featureflag.IsDisabled(ctx, featureflag.GoUpdateHook))), // default on fmt.Sprintf("%s=%s", featureflag.GoPreReceiveHookEnvVar, strconv.FormatBool(featureflag.IsEnabled(ctx, featureflag.GoPreReceiveHook))), }, gitlabshellEnv...) diff --git a/internal/service/operations/apply_patch_test.go b/internal/service/operations/apply_patch_test.go index 309bc2b0dda4dd64a581edb859f6bd9bc8ef703b..1b24b23915133606ced3741f9f4e8a62ab839527 100644 --- a/internal/service/operations/apply_patch_test.go +++ b/internal/service/operations/apply_patch_test.go @@ -12,7 +12,6 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/git/log" - "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "gitlab.com/gitlab-org/gitaly/streamio" @@ -20,17 +19,10 @@ import ( ) func TestSuccessfulUserApplyPatch(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testSuccessfulUserApplyPatch(t, ctx) - }) - } + testSuccessfulUserApplyPatch(t, ctx) } func testSuccessfulUserApplyPatch(t *testing.T, ctx context.Context) { diff --git a/internal/service/operations/branches_test.go b/internal/service/operations/branches_test.go index 0d8b94ccff7308dee7313c141b159cda6b45d227..e290e394837bd2ca3990572d2953bca6e1f6c26b 100644 --- a/internal/service/operations/branches_test.go +++ b/internal/service/operations/branches_test.go @@ -7,7 +7,6 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/git/log" - "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -76,17 +75,10 @@ func TestSuccessfulCreateBranchRequest(t *testing.T) { } func TestSuccessfulGitHooksForUserCreateBranchRequest(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testSuccessfulGitHooksForUserCreateBranchRequest(t, ctx) - }) - } + testSuccessfulGitHooksForUserCreateBranchRequest(t, ctx) } func testSuccessfulGitHooksForUserCreateBranchRequest(t *testing.T, ctx context.Context) { diff --git a/internal/service/operations/cherry_pick_test.go b/internal/service/operations/cherry_pick_test.go index 3a30688b772f5b141ba3b4109a3d221e275d7164..6bbb68acbd285e16c00a54d7ef4d192fc22bf02d 100644 --- a/internal/service/operations/cherry_pick_test.go +++ b/internal/service/operations/cherry_pick_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/git/log" - "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -117,17 +116,10 @@ func TestSuccessfulUserCherryPickRequest(t *testing.T) { } func TestSuccessfulGitHooksForUserCherryPickRequest(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testSuccessfulGitHooksForUserCherryPickRequest(t, ctx) - }) - } + testSuccessfulGitHooksForUserCherryPickRequest(t, ctx) } func testSuccessfulGitHooksForUserCherryPickRequest(t *testing.T, ctxOuter context.Context) { diff --git a/internal/service/operations/commit_files_test.go b/internal/service/operations/commit_files_test.go index 2aceef1ba2bd7d5215cc62efa5ada83dcdc18612..391ba9c24e60564a0d326b81ef5f372b11e3d70c 100644 --- a/internal/service/operations/commit_files_test.go +++ b/internal/service/operations/commit_files_test.go @@ -9,7 +9,6 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/git/log" "gitlab.com/gitlab-org/gitaly/internal/helper/text" - "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -127,17 +126,10 @@ func testSuccessfulUserCommitFilesRequest(t *testing.T, ctxWithFeatureFlags cont } func TestSuccessfulUserCommitFilesRequest(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testSuccessfulUserCommitFilesRequest(t, ctx) - }) - } + testSuccessfulUserCommitFilesRequest(t, ctx) } func TestSuccessfulUserCommitFilesRequestMove(t *testing.T) { diff --git a/internal/service/operations/merge_test.go b/internal/service/operations/merge_test.go index bb5ef67aad73dfa1462ae89c3a0fab968e1f04d1..cd300739009385f5a6ee285d0c094e9d2aee36be 100644 --- a/internal/service/operations/merge_test.go +++ b/internal/service/operations/merge_test.go @@ -12,7 +12,6 @@ import ( "github.com/stretchr/testify/require" gitlog "gitlab.com/gitlab-org/gitaly/internal/git/log" "gitlab.com/gitlab-org/gitaly/internal/helper/text" - "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -25,17 +24,10 @@ var ( ) func TestSuccessfulMerge(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testSuccessfulMerge(t, ctx) - }) - } + testSuccessfulMerge(t, ctx) } func testSuccessfulMerge(t *testing.T, ctx context.Context) { diff --git a/internal/service/operations/rebase_test.go b/internal/service/operations/rebase_test.go index 7df1cf61810e8739a9b915b70bc4b1f5c83bafc0..a7d0aeb4692a9c0a388f9303409d3d23baf9c621 100644 --- a/internal/service/operations/rebase_test.go +++ b/internal/service/operations/rebase_test.go @@ -11,7 +11,6 @@ import ( "github.com/stretchr/testify/require" gitlog "gitlab.com/gitlab-org/gitaly/internal/git/log" - "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/rubyserver" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" @@ -24,8 +23,6 @@ var ( ) func TestSuccessfulUserRebaseConfirmableRequest(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) ctx, cancel := testhelper.Context() defer cancel() @@ -41,12 +38,7 @@ func TestSuccessfulUserRebaseConfirmableRequest(t *testing.T) { serverSocketPath, stop := runOperationServiceServerWithRubyServer(t, &ruby) defer stop() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testSuccessfulUserRebaseConfirmableRequest(t, ctx, serverSocketPath, pushOptions) - }) - } + testSuccessfulUserRebaseConfirmableRequest(t, ctx, serverSocketPath, pushOptions) } func testSuccessfulUserRebaseConfirmableRequest(t *testing.T, ctxOuter context.Context, serverSocketPath string, pushOptions []string) { diff --git a/internal/service/operations/revert_test.go b/internal/service/operations/revert_test.go index a910bc25d98d11f4c516aa40d8635a2a6a9d69fc..3922550876ba1f97fb51a56743ac19b3f3910a05 100644 --- a/internal/service/operations/revert_test.go +++ b/internal/service/operations/revert_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/git/log" - "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -117,17 +116,10 @@ func TestSuccessfulUserRevertRequest(t *testing.T) { } func TestSuccessfulGitHooksForUserRevertRequest(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testSuccessfulGitHooksForUserRevertRequest(t, ctx) - }) - } + testSuccessfulGitHooksForUserRevertRequest(t, ctx) } func testSuccessfulGitHooksForUserRevertRequest(t *testing.T, ctxOuter context.Context) { diff --git a/internal/service/operations/squash_test.go b/internal/service/operations/squash_test.go index 6a363ec9adc2547d367550f67c33bd9b628ff93b..7164f8dc5c46bb82f7507021fe36007a8c8b79df 100644 --- a/internal/service/operations/squash_test.go +++ b/internal/service/operations/squash_test.go @@ -11,7 +11,6 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/git/log" "gitlab.com/gitlab-org/gitaly/internal/helper/text" - "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -29,17 +28,10 @@ var ( ) func TestSuccessfulUserSquashRequest(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testSuccessfulUserSquashRequest(t, ctx) - }) - } + testSuccessfulUserSquashRequest(t, ctx) } func testSuccessfulUserSquashRequest(t *testing.T, ctx context.Context) { diff --git a/internal/service/operations/submodules_test.go b/internal/service/operations/submodules_test.go index b59deb76de6a5e05002f05ed08b00324cd04c24c..e3de793b07dace7afbc51bac32ab27b68672ff29 100644 --- a/internal/service/operations/submodules_test.go +++ b/internal/service/operations/submodules_test.go @@ -9,24 +9,16 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/git/log" "gitlab.com/gitlab-org/gitaly/internal/git/lstree" - "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc/codes" ) func TestSuccessfulUserUpdateSubmoduleRequest(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testSuccessfulUserUpdateSubmoduleRequest(t, ctx) - }) - } + testSuccessfulUserUpdateSubmoduleRequest(t, ctx) } func testSuccessfulUserUpdateSubmoduleRequest(t *testing.T, ctx context.Context) { diff --git a/internal/service/operations/tags_test.go b/internal/service/operations/tags_test.go index 201eda9b35fa2423590859593780ed05a70996b5..8e894660837dd48d29b5f057406b906809c9b504 100644 --- a/internal/service/operations/tags_test.go +++ b/internal/service/operations/tags_test.go @@ -11,7 +11,6 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/git/log" "gitlab.com/gitlab-org/gitaly/internal/helper/text" - "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -50,17 +49,10 @@ func TestSuccessfulUserDeleteTagRequest(t *testing.T) { } func TestSuccessfulGitHooksForUserDeleteTagRequest(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testSuccessfulGitHooksForUserDeleteTagRequest(t, ctx) - }) - } + testSuccessfulGitHooksForUserDeleteTagRequest(t, ctx) } func testSuccessfulGitHooksForUserDeleteTagRequest(t *testing.T, ctx context.Context) { @@ -195,17 +187,9 @@ func TestSuccessfulUserCreateTagRequest(t *testing.T) { } func TestSuccessfulGitHooksForUserCreateTagRequest(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) - ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testSuccessfulGitHooksForUserCreateTagRequest(t, ctx) - }) - } + testSuccessfulGitHooksForUserCreateTagRequest(t, ctx) } func testSuccessfulGitHooksForUserCreateTagRequest(t *testing.T, ctx context.Context) { @@ -298,17 +282,10 @@ func TestFailedUserDeleteTagRequestDueToValidation(t *testing.T) { } func TestFailedUserDeleteTagDueToHooks(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) - ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testFailedUserDeleteTagDueToHooks(t, ctx) - }) - } + + testFailedUserDeleteTagDueToHooks(t, ctx) } func testFailedUserDeleteTagDueToHooks(t *testing.T, ctx context.Context) { diff --git a/internal/service/operations/update_branches_test.go b/internal/service/operations/update_branches_test.go index 978195c27caa3615c02008549da68fe0e016608a..f95b4144dbd82151ce395f74958c86e65ed75843 100644 --- a/internal/service/operations/update_branches_test.go +++ b/internal/service/operations/update_branches_test.go @@ -8,7 +8,6 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/git/log" - "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -53,17 +52,10 @@ func TestSuccessfulUserUpdateBranchRequest(t *testing.T) { } func TestSuccessfulGitHooksForUserUpdateBranchRequest(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testSuccessfulGitHooksForUserUpdateBranchRequest(t, ctx) - }) - } + testSuccessfulGitHooksForUserUpdateBranchRequest(t, ctx) } func testSuccessfulGitHooksForUserUpdateBranchRequest(t *testing.T, ctx context.Context) { @@ -100,17 +92,10 @@ func testSuccessfulGitHooksForUserUpdateBranchRequest(t *testing.T, ctx context. } func TestFailedUserUpdateBranchDueToHooks(t *testing.T) { - featureSet, err := testhelper.NewFeatureSets(nil, featureflag.GoUpdateHook) - require.NoError(t, err) ctx, cancel := testhelper.Context() defer cancel() - for _, features := range featureSet { - t.Run(features.String(), func(t *testing.T) { - ctx = features.WithParent(ctx) - testFailedUserUpdateBranchDueToHooks(t, ctx) - }) - } + testFailedUserUpdateBranchDueToHooks(t, ctx) } func testFailedUserUpdateBranchDueToHooks(t *testing.T, ctx context.Context) {