diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-02 11:30:09 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-02 15:40:35 +0300 |
commit | a852018be2f88e5ce934533d56e5953666f18349 (patch) | |
tree | d49c1ccf6d622908c967a48130338c7d7662b989 | |
parent | d07ed513fd4723ed9c1af1cd749ccc478e38aab9 (diff) |
git: Add execution environment for bundled Git v2.36.0.gl1pks-git-v2.36.0
Add a new execution environment for bundled Git v2.36.0.gl1. This
environment is still guarded by a feature flag.
Changelog: added
-rw-r--r-- | internal/git/command_factory_test.go | 4 | ||||
-rw-r--r-- | internal/git/execution_environment.go | 6 | ||||
-rw-r--r-- | internal/metadata/featureflag/ff_git_v2360.go | 4 | ||||
-rw-r--r-- | internal/testhelper/testhelper.go | 6 |
4 files changed, 19 insertions, 1 deletions
diff --git a/internal/git/command_factory_test.go b/internal/git/command_factory_test.go index e9eee0a40..765837ad3 100644 --- a/internal/git/command_factory_test.go +++ b/internal/git/command_factory_test.go @@ -17,6 +17,7 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/v14/internal/helper/text" + "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" ) @@ -180,7 +181,8 @@ func TestCommandFactory_ExecutionEnvironment(t *testing.T) { }) t.Run("set using GITALY_TESTING_BUNDLED_GIT_PATH", func(t *testing.T) { - suffix := "-v2.35.1.gl1" + ctx := featureflag.ContextWithFeatureFlag(ctx, featureflag.GitV2360Gl1, true) + suffix := "-v2.36.0.gl1" bundledGitDir := testhelper.TempDir(t) diff --git a/internal/git/execution_environment.go b/internal/git/execution_environment.go index f5aa36b53..7122f3d3c 100644 --- a/internal/git/execution_environment.go +++ b/internal/git/execution_environment.go @@ -26,6 +26,12 @@ var ( // case `IsEnabled()` returns `false` though. ExecutionEnvironmentConstructors = []ExecutionEnvironmentConstructor{ BundledGitEnvironmentConstructor{ + Suffix: "-v2.36.0.gl1", + FeatureFlags: []featureflag.FeatureFlag{ + featureflag.GitV2360Gl1, + }, + }, + BundledGitEnvironmentConstructor{ Suffix: "-v2.35.1.gl1", }, DistributedGitEnvironmentConstructor{}, diff --git a/internal/metadata/featureflag/ff_git_v2360.go b/internal/metadata/featureflag/ff_git_v2360.go new file mode 100644 index 000000000..bc2a3971b --- /dev/null +++ b/internal/metadata/featureflag/ff_git_v2360.go @@ -0,0 +1,4 @@ +package featureflag + +// GitV2360Gl1 will enable use of Git v2.36.0.gl1. +var GitV2360Gl1 = NewFeatureFlag("git_v2360gl1", false) diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go index 2e780398b..05cdfe66e 100644 --- a/internal/testhelper/testhelper.go +++ b/internal/testhelper/testhelper.go @@ -11,6 +11,7 @@ import ( "fmt" "io" "math/big" + mrand "math/rand" "net" "os" "os/exec" @@ -159,6 +160,8 @@ func Context(t testing.TB, opts ...ContextOpt) context.Context { func ContextWithoutCancel(opts ...ContextOpt) context.Context { ctx := context.Background() + rnd := mrand.New(mrand.NewSource(time.Now().Unix())) + // Enable use of explicit feature flags. Each feature flag which is checked must have been // explicitly injected into the context, or otherwise we panic. This is a sanity check to // verify that all feature flags we introduce are tested both with the flag enabled and @@ -174,6 +177,9 @@ func ContextWithoutCancel(opts ...ContextOpt) context.Context { // ConcurrencyQueueMaxWait is in the codepath of every RPC call since it's in the limithandler // middleware. ctx = featureflag.ContextWithFeatureFlag(ctx, featureflag.ConcurrencyQueueMaxWait, true) + // Randomly inject the Git flag so that we have coverage of tests with both old and new Git + // version by pure chance. + ctx = featureflag.ContextWithFeatureFlag(ctx, featureflag.GitV2360Gl1, rnd.Int()%2 == 0) for _, opt := range opts { ctx = opt(ctx) |