aboutsummaryrefslogtreecommitdiffstats
path: root/repository/gogit_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository/gogit_test.go')
-rw-r--r--repository/gogit_test.go31
1 files changed, 6 insertions, 25 deletions
diff --git a/repository/gogit_test.go b/repository/gogit_test.go
index 8179874c..5d3378b7 100644
--- a/repository/gogit_test.go
+++ b/repository/gogit_test.go
@@ -1,8 +1,6 @@
package repository
import (
- "io/ioutil"
- "os"
"path"
"path/filepath"
"testing"
@@ -13,26 +11,14 @@ import (
func TestNewGoGitRepo(t *testing.T) {
// Plain
- plainRoot, err := ioutil.TempDir("", "")
- require.NoError(t, err)
- t.Cleanup(func() {
- require.NoError(t, os.RemoveAll(plainRoot))
- })
-
- plainRepo, err := InitGoGitRepo(plainRoot, namespace)
- require.NoError(t, err)
+ plainRepo := CreateGoGitTestRepo(t, false)
+ plainRoot := RepoDir(t, plainRepo)
require.NoError(t, plainRepo.Close())
plainGitDir := filepath.Join(plainRoot, ".git")
// Bare
- bareRoot, err := ioutil.TempDir("", "")
- require.NoError(t, err)
- t.Cleanup(func() {
- require.NoError(t, os.RemoveAll(bareRoot))
- })
-
- bareRepo, err := InitBareGoGitRepo(bareRoot, namespace)
- require.NoError(t, err)
+ bareRepo := CreateGoGitTestRepo(t, true)
+ bareRoot := RepoDir(t, bareRepo)
require.NoError(t, bareRepo.Close())
bareGitDir := bareRoot
@@ -75,13 +61,8 @@ func TestGoGitRepo(t *testing.T) {
}
func TestGoGitRepo_Indexes(t *testing.T) {
- plainRoot := t.TempDir()
-
- repo, err := InitGoGitRepo(plainRoot, namespace)
- require.NoError(t, err)
- t.Cleanup(func() {
- require.NoError(t, repo.Close())
- })
+ repo := CreateGoGitTestRepo(t, false)
+ plainRoot := RepoDir(t, repo)
// Can create indices
indexA, err := repo.GetBleveIndex("a")