summaryrefslogtreecommitdiffstatshomepage
path: root/repository/repo_testing.go
diff options
context:
space:
mode:
authorSteve Moyer <smoyer1@selesy.com>2022-06-24 09:52:58 -0400
committerGitHub <noreply@github.com>2022-06-24 09:52:58 -0400
commit00b9e1a6028388b332f14ff3e607f02d589b637b (patch)
tree7e9a89ce480f537c3bbe0fb942d1bc9a1c3f758f /repository/repo_testing.go
parentb694052c46a69b47e58526068109db2fbcca92af (diff)
parentfd248de1eb5591ea977fdfcedf75d26f53636a5e (diff)
downloadgit-bug-00b9e1a6028388b332f14ff3e607f02d589b637b.tar.gz
git-bug-00b9e1a6028388b332f14ff3e607f02d589b637b.zip
Merge pull request #817 from MichaelMure/refactor/guarantee-test-cleanup
refactor(809): guarantee test cleanup
Diffstat (limited to 'repository/repo_testing.go')
-rw-r--r--repository/repo_testing.go28
1 files changed, 3 insertions, 25 deletions
diff --git a/repository/repo_testing.go b/repository/repo_testing.go
index 0db585cd4..5d51d23ff 100644
--- a/repository/repo_testing.go
+++ b/repository/repo_testing.go
@@ -1,7 +1,6 @@
package repository
import (
- "log"
"math/rand"
"testing"
@@ -14,37 +13,16 @@ import (
// TODO: add tests for RepoBleve
// TODO: add tests for RepoStorage
-func CleanupTestRepos(repos ...Repo) {
- var firstErr error
- for _, repo := range repos {
- if repo, ok := repo.(TestedRepo); ok {
- err := repo.EraseFromDisk()
- if err != nil {
- log.Println(err)
- if firstErr == nil {
- firstErr = err
- }
- }
- }
- }
-
- if firstErr != nil {
- log.Fatal(firstErr)
- }
-}
-
-type RepoCreator func(bare bool) TestedRepo
-type RepoCleaner func(repos ...Repo)
+type RepoCreator func(t testing.TB, bare bool) TestedRepo
// Test suite for a Repo implementation
-func RepoTest(t *testing.T, creator RepoCreator, cleaner RepoCleaner) {
+func RepoTest(t *testing.T, creator RepoCreator) {
for bare, name := range map[bool]string{
false: "Plain",
true: "Bare",
} {
t.Run(name, func(t *testing.T) {
- repo := creator(bare)
- defer cleaner(repo)
+ repo := creator(t, bare)
t.Run("Data", func(t *testing.T) {
RepoDataTest(t, repo)