diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2019-05-06 19:02:32 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2019-05-06 19:02:32 +0300 |
commit | ae1d4797f13c31a7b71601def595c22b7df5f8fe (patch) | |
tree | d88001dcdb6206473a49235650eb4bccbff88969 | |
parent | 6f8f5ae53799e8275ed1f83a99cdaa96467125b2 (diff) |
Use cat-file caching in tests by default
-rw-r--r-- | internal/testhelper/testhelper.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go index 5b139227f..ba91df833 100644 --- a/internal/testhelper/testhelper.go +++ b/internal/testhelper/testhelper.go @@ -28,9 +28,11 @@ import ( "gitlab.com/gitlab-org/gitaly-proto/go/gitalypb" "gitlab.com/gitlab-org/gitaly/internal/command" "gitlab.com/gitlab-org/gitaly/internal/config" + "gitlab.com/gitlab-org/gitaly/internal/git/catfile" "gitlab.com/gitlab-org/gitaly/internal/helper/fieldextractors" "gitlab.com/gitlab-org/gitaly/internal/helper/text" gitalylog "gitlab.com/gitlab-org/gitaly/internal/log" + "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/internal/storage" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -302,6 +304,7 @@ func NewTestGrpcServer(tb testing.TB, streamInterceptors []grpc.StreamServerInte func MustHaveNoChildProcess() { waitDone := make(chan struct{}) go func() { + catfile.ExpireAll() command.WaitAllDone() close(waitDone) }() @@ -348,7 +351,15 @@ func mustFindNoRunningChildProcess() { // Context returns a cancellable context. func Context() (context.Context, func()) { - return context.WithCancel(context.Background()) + ctx, cancel := context.WithCancel(context.Background()) + + md := metadata.New(map[string]string{ + featureflag.HeaderKey(catfile.CacheFeatureFlagKey): "true", + "gitaly-session-id": "gitaly-test", + }) + ctx = metadata.NewOutgoingContext(ctx, md) + + return ctx, cancel } // CreateRepo creates an temporary directory for a repo, without initializing it |