diff options
author | James Fargher <proglottis@gmail.com> | 2021-04-27 01:42:32 +0300 |
---|---|---|
committer | James Fargher <proglottis@gmail.com> | 2021-04-27 01:42:32 +0300 |
commit | 2a8ce2b89c336659e5d5768ab6054881856651c6 (patch) | |
tree | 63ea6f2e298fdcee0bb2a4f06f97db4c6c221de0 | |
parent | 585cfd46d6be12237b640d19cbd730f3065e0ecc (diff) | |
parent | 4b22c0fec0b88fb534fed609c2d465ee552fe9f0 (diff) |
Merge branch 'ps-rm-config-tempdir' into 'master'
Remove config.Config from tempdir package
See merge request gitlab-org/gitaly!3377
-rw-r--r-- | internal/tempdir/tempdir_test.go | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/internal/tempdir/tempdir_test.go b/internal/tempdir/tempdir_test.go index fef06b361..4342e724e 100644 --- a/internal/tempdir/tempdir_test.go +++ b/internal/tempdir/tempdir_test.go @@ -13,6 +13,7 @@ import ( "gitlab.com/gitlab-org/gitaly/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/internal/testhelper" + "gitlab.com/gitlab-org/gitaly/internal/testhelper/testcfg" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" ) @@ -20,10 +21,8 @@ func TestNewAsRepositorySuccess(t *testing.T) { ctx, cancel := testhelper.Context() defer cancel() - repo, _, cleanup := gittest.CloneRepo(t) - defer cleanup() - - locator := config.NewLocator(config.Config) + cfg, repo, _ := testcfg.BuildWithRepo(t) + locator := config.NewLocator(cfg) tempRepo, tempDir, err := NewAsRepository(ctx, repo, locator) require.NoError(t, err) require.NotEqual(t, repo, tempRepo) @@ -104,19 +103,17 @@ func TestCleanSuccess(t *testing.T) { } func TestCleanTempDir(t *testing.T) { + cfg := testcfg.Build(t, testcfg.WithStorages("first", "second")) + gittest.CloneRepoAtStorage(t, cfg.Storages[0], t.Name()) + logrus.SetLevel(logrus.InfoLevel) logrus.SetOutput(ioutil.Discard) hook := test.NewGlobal() - storages := append(config.Config.Storages[:], config.Storage{ - Name: "default", - Path: "testdata/clean", - }) - - cleanTempDir(storages) + cleanTempDir(cfg.Storages) - require.Equal(t, 2, len(hook.Entries)) + require.Equal(t, 2, len(hook.Entries), hook.Entries) require.Equal(t, "finished tempdir cleaner walk", hook.LastEntry().Message) } |