Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Strokov <pstrokov@gitlab.com>2021-02-21 20:39:31 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2021-02-21 20:39:31 +0300
commita0edbc3e259780910abd07c7fe2cbd4be58211fd (patch)
treef0d21b2564d3e9cff7fb7d8d6263844fb34cff1a
parent3f29772a7241e66cc89608778b2411f2a3733a17 (diff)
Removal of config.Config from the TestLoserCount
TestLoserCount doesn't rely on the config.Config variable anymore and uses locally built config instance. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
-rw-r--r--internal/cache/cachedb_test.go27
1 files changed, 6 insertions, 21 deletions
diff --git a/internal/cache/cachedb_test.go b/internal/cache/cachedb_test.go
index 4d7814828..02e102913 100644
--- a/internal/cache/cachedb_test.go
+++ b/internal/cache/cachedb_test.go
@@ -5,7 +5,6 @@ import (
"io"
"io/ioutil"
"os"
- "path/filepath"
"strings"
"sync"
"testing"
@@ -16,6 +15,7 @@ import (
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
+ "gitlab.com/gitlab-org/gitaly/internal/testhelper/testcfg"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
@@ -132,34 +132,19 @@ func TestStreamDBNaiveKeyer(t *testing.T) {
require.NoError(t, err)
}
-func injectTempStorage(t testing.TB) (string, testhelper.Cleanup) {
- oldStorages := config.Config.Storages
- tmpDir, cleanup := testhelper.TempDir(t)
-
- name := filepath.Base(tmpDir)
- config.Config.Storages = append(config.Config.Storages, config.Storage{
- Name: name,
- Path: tmpDir,
- })
-
- return name, func() {
- config.Config.Storages = oldStorages
- cleanup()
- }
-}
-
func TestLoserCount(t *testing.T) {
// the test can be contaminate by other tests using the cache, so a
// dedicated storage location should be used
- storageName, storageCleanup := injectTempStorage(t)
- defer storageCleanup()
+ cfgBuilder := testcfg.NewGitalyCfgBuilder(testcfg.WithStorages("storage-1", "storage-2"))
+ defer cfgBuilder.Cleanup()
+ cfg := cfgBuilder.Build(t)
- db := cache.NewStreamDB(cache.NewLeaseKeyer(config.NewLocator(config.Config)))
+ db := cache.NewStreamDB(cache.NewLeaseKeyer(config.NewLocator(cfg)))
req := &gitalypb.InfoRefsRequest{
Repository: &gitalypb.Repository{
RelativePath: "test",
- StorageName: storageName,
+ StorageName: "storage-1",
},
}
ctx := testhelper.SetCtxGrpcMethod(context.Background(), "InfoRefsUploadPack")