aboutsummaryrefslogtreecommitdiffstats
path: root/cache/repo_cache_test.go
diff options
context:
space:
mode:
authorSteve Moyer <smoyer1@selesy.com>2022-06-16 09:02:52 -0400
committerSteve Moyer <smoyer1@selesy.com>2022-06-16 09:02:52 -0400
commit1d4667c825bb5d291070bd4463c39a16f950f674 (patch)
tree84f1101f4cddc3804955c2c2ff90e3687c1dafee /cache/repo_cache_test.go
parentd853a6fbc996762ab264452150558bb92bdbd6fc (diff)
downloadgit-bug-1d4667c825bb5d291070bd4463c39a16f950f674.tar.gz
refactor(809): eliminate need to defer CleanupTestRepos()
Diffstat (limited to 'cache/repo_cache_test.go')
-rw-r--r--cache/repo_cache_test.go18
1 files changed, 7 insertions, 11 deletions
diff --git a/cache/repo_cache_test.go b/cache/repo_cache_test.go
index d13fa026..c01f5478 100644
--- a/cache/repo_cache_test.go
+++ b/cache/repo_cache_test.go
@@ -14,8 +14,7 @@ import (
)
func TestCache(t *testing.T) {
- repo := repository.CreateGoGitTestRepo(false)
- defer repository.CleanupTestRepos(repo)
+ repo := repository.CreateGoGitTestRepo(t, false)
cache, err := NewRepoCache(repo)
require.NoError(t, err)
@@ -112,8 +111,7 @@ func TestCache(t *testing.T) {
}
func TestCachePushPull(t *testing.T) {
- repoA, repoB, remote := repository.SetupGoGitReposAndRemote()
- defer repository.CleanupTestRepos(repoA, repoB, remote)
+ repoA, repoB, _ := repository.SetupGoGitReposAndRemote(t)
cacheA, err := NewRepoCache(repoA)
require.NoError(t, err)
@@ -171,10 +169,9 @@ func TestCachePushPull(t *testing.T) {
}
func TestRemove(t *testing.T) {
- repo := repository.CreateGoGitTestRepo(false)
- remoteA := repository.CreateGoGitTestRepo(true)
- remoteB := repository.CreateGoGitTestRepo(true)
- defer repository.CleanupTestRepos(repo, remoteA, remoteB)
+ repo := repository.CreateGoGitTestRepo(t, false)
+ remoteA := repository.CreateGoGitTestRepo(t, true)
+ remoteB := repository.CreateGoGitTestRepo(t, true)
err := repo.AddRemote("remoteA", remoteA.GetLocalRemote())
require.NoError(t, err)
@@ -220,7 +217,7 @@ func TestRemove(t *testing.T) {
}
func TestCacheEviction(t *testing.T) {
- repo := repository.CreateGoGitTestRepo(false)
+ repo := repository.CreateGoGitTestRepo(t, false)
repoCache, err := NewRepoCache(repo)
require.NoError(t, err)
repoCache.setCacheSize(2)
@@ -287,8 +284,7 @@ func TestLongDescription(t *testing.T) {
text := strings.Repeat("x", 65536)
- repo := repository.CreateGoGitTestRepo(false)
- defer repository.CleanupTestRepos(repo)
+ repo := repository.CreateGoGitTestRepo(t, false)
backend, err := NewRepoCache(repo)
require.NoError(t, err)