aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/transport')
-rw-r--r--plumbing/transport/file/common_test.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/plumbing/transport/file/common_test.go b/plumbing/transport/file/common_test.go
index 3dc4500..4f3ae8f 100644
--- a/plumbing/transport/file/common_test.go
+++ b/plumbing/transport/file/common_test.go
@@ -1,6 +1,7 @@
package file
import (
+ "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -8,13 +9,13 @@ import (
"github.com/src-d/go-git-fixtures"
. "gopkg.in/check.v1"
- "io/ioutil"
)
type CommonSuite struct {
fixtures.Suite
ReceivePackBin string
UploadPackBin string
+ tmpDir string // to be removed at teardown
}
var _ = Suite(&CommonSuite{})
@@ -26,14 +27,20 @@ func (s *CommonSuite) SetUpSuite(c *C) {
c.Skip("git command not found")
}
- binDir, err := ioutil.TempDir(os.TempDir(), "")
+ var err error
+ s.tmpDir, err = ioutil.TempDir("", "")
c.Assert(err, IsNil)
- s.ReceivePackBin = filepath.Join(binDir, "git-receive-pack")
- s.UploadPackBin = filepath.Join(binDir, "git-upload-pack")
- bin := filepath.Join(binDir, "go-git")
+ s.ReceivePackBin = filepath.Join(s.tmpDir, "git-receive-pack")
+ s.UploadPackBin = filepath.Join(s.tmpDir, "git-upload-pack")
+ bin := filepath.Join(s.tmpDir, "go-git")
cmd := exec.Command("go", "build", "-o", bin,
"../../../cli/go-git/...")
c.Assert(cmd.Run(), IsNil)
c.Assert(os.Symlink(bin, s.ReceivePackBin), IsNil)
c.Assert(os.Symlink(bin, s.UploadPackBin), IsNil)
}
+
+func (s *CommonSuite) TearDownSuite(c *C) {
+ defer s.Suite.TearDownSuite(c)
+ c.Assert(os.RemoveAll(s.tmpDir), IsNil)
+}