aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing')
-rw-r--r--plumbing/format/index/decoder_test.go7
-rw-r--r--plumbing/transport/file/server_test.go15
-rw-r--r--plumbing/transport/ssh/auth_method_test.go2
-rw-r--r--plumbing/transport/test/upload_pack.go6
4 files changed, 29 insertions, 1 deletions
diff --git a/plumbing/format/index/decoder_test.go b/plumbing/format/index/decoder_test.go
index fd83ffb..c3fa590 100644
--- a/plumbing/format/index/decoder_test.go
+++ b/plumbing/format/index/decoder_test.go
@@ -21,6 +21,7 @@ var _ = Suite(&IndexSuite{})
func (s *IndexSuite) TestDecode(c *C) {
f, err := fixtures.Basic().One().DotGit().Open("index")
c.Assert(err, IsNil)
+ defer func() { c.Assert(f.Close(), IsNil) }()
idx := &Index{}
d := NewDecoder(f)
@@ -34,6 +35,7 @@ func (s *IndexSuite) TestDecode(c *C) {
func (s *IndexSuite) TestDecodeEntries(c *C) {
f, err := fixtures.Basic().One().DotGit().Open("index")
c.Assert(err, IsNil)
+ defer func() { c.Assert(f.Close(), IsNil) }()
idx := &Index{}
d := NewDecoder(f)
@@ -64,6 +66,7 @@ func (s *IndexSuite) TestDecodeEntries(c *C) {
func (s *IndexSuite) TestDecodeCacheTree(c *C) {
f, err := fixtures.Basic().One().DotGit().Open("index")
c.Assert(err, IsNil)
+ defer func() { c.Assert(f.Close(), IsNil) }()
idx := &Index{}
d := NewDecoder(f)
@@ -93,6 +96,7 @@ var expectedEntries = []TreeEntry{
func (s *IndexSuite) TestDecodeMergeConflict(c *C) {
f, err := fixtures.Basic().ByTag("merge-conflict").One().DotGit().Open("index")
c.Assert(err, IsNil)
+ defer func() { c.Assert(f.Close(), IsNil) }()
idx := &Index{}
d := NewDecoder(f)
@@ -130,6 +134,7 @@ func (s *IndexSuite) TestDecodeMergeConflict(c *C) {
func (s *IndexSuite) TestDecodeExtendedV3(c *C) {
f, err := fixtures.Basic().ByTag("intent-to-add").One().DotGit().Open("index")
c.Assert(err, IsNil)
+ defer func() { c.Assert(f.Close(), IsNil) }()
idx := &Index{}
d := NewDecoder(f)
@@ -147,6 +152,7 @@ func (s *IndexSuite) TestDecodeExtendedV3(c *C) {
func (s *IndexSuite) TestDecodeResolveUndo(c *C) {
f, err := fixtures.Basic().ByTag("resolve-undo").One().DotGit().Open("index")
c.Assert(err, IsNil)
+ defer func() { c.Assert(f.Close(), IsNil) }()
idx := &Index{}
d := NewDecoder(f)
@@ -172,6 +178,7 @@ func (s *IndexSuite) TestDecodeResolveUndo(c *C) {
func (s *IndexSuite) TestDecodeV4(c *C) {
f, err := fixtures.Basic().ByTag("index-v4").One().DotGit().Open("index")
c.Assert(err, IsNil)
+ defer func() { c.Assert(f.Close(), IsNil) }()
idx := &Index{}
d := NewDecoder(f)
diff --git a/plumbing/transport/file/server_test.go b/plumbing/transport/file/server_test.go
index ee72282..080beef 100644
--- a/plumbing/transport/file/server_test.go
+++ b/plumbing/transport/file/server_test.go
@@ -35,6 +35,10 @@ func (s *ServerSuite) SetUpSuite(c *C) {
}
func (s *ServerSuite) TestPush(c *C) {
+ if !s.checkExecPerm(c) {
+ c.Skip("go-git binary has not execution permissions")
+ }
+
// git <2.0 cannot push to an empty repository without a refspec.
cmd := exec.Command("git", "push",
"--receive-pack", s.ReceivePackBin,
@@ -48,6 +52,10 @@ func (s *ServerSuite) TestPush(c *C) {
}
func (s *ServerSuite) TestClone(c *C) {
+ if !s.checkExecPerm(c) {
+ c.Skip("go-git binary has not execution permissions")
+ }
+
pathToClone := c.MkDir()
cmd := exec.Command("git", "clone",
@@ -59,3 +67,10 @@ func (s *ServerSuite) TestClone(c *C) {
out, err := cmd.CombinedOutput()
c.Assert(err, IsNil, Commentf("combined stdout and stderr:\n%s\n", out))
}
+
+func (s *ServerSuite) checkExecPerm(c *C) bool {
+ const userExecPermMask = 0100
+ info, err := os.Stat(s.ReceivePackBin)
+ c.Assert(err, IsNil)
+ return (info.Mode().Perm() & userExecPermMask) == userExecPermMask
+}
diff --git a/plumbing/transport/ssh/auth_method_test.go b/plumbing/transport/ssh/auth_method_test.go
index aa05f7f..2ee5100 100644
--- a/plumbing/transport/ssh/auth_method_test.go
+++ b/plumbing/transport/ssh/auth_method_test.go
@@ -115,7 +115,7 @@ func (s *SuiteCommon) TestNewSSHAgentAuthNoAgent(c *C) {
k, err := NewSSHAgentAuth("foo")
c.Assert(k, IsNil)
- c.Assert(err, ErrorMatches, ".*SSH_AUTH_SOCK.*")
+ c.Assert(err, ErrorMatches, ".*SSH_AUTH_SOCK.*|.*SSH agent .* not running.*")
}
func (*SuiteCommon) TestNewPublicKeys(c *C) {
diff --git a/plumbing/transport/test/upload_pack.go b/plumbing/transport/test/upload_pack.go
index ade6cdc..b3acc4f 100644
--- a/plumbing/transport/test/upload_pack.go
+++ b/plumbing/transport/test/upload_pack.go
@@ -31,6 +31,8 @@ type UploadPackSuite struct {
func (s *UploadPackSuite) TestAdvertisedReferencesEmpty(c *C) {
r, err := s.Client.NewUploadPackSession(s.EmptyEndpoint, s.EmptyAuth)
c.Assert(err, IsNil)
+ defer func() { c.Assert(r.Close(), IsNil) }()
+
ar, err := r.AdvertisedReferences()
c.Assert(err, Equals, transport.ErrEmptyRemoteRepository)
c.Assert(ar, IsNil)
@@ -39,6 +41,8 @@ func (s *UploadPackSuite) TestAdvertisedReferencesEmpty(c *C) {
func (s *UploadPackSuite) TestAdvertisedReferencesNotExists(c *C) {
r, err := s.Client.NewUploadPackSession(s.NonExistentEndpoint, s.EmptyAuth)
c.Assert(err, IsNil)
+ defer func() { c.Assert(r.Close(), IsNil) }()
+
ar, err := r.AdvertisedReferences()
c.Assert(err, Equals, transport.ErrRepositoryNotFound)
c.Assert(ar, IsNil)
@@ -55,6 +59,8 @@ func (s *UploadPackSuite) TestAdvertisedReferencesNotExists(c *C) {
func (s *UploadPackSuite) TestCallAdvertisedReferenceTwice(c *C) {
r, err := s.Client.NewUploadPackSession(s.Endpoint, s.EmptyAuth)
c.Assert(err, IsNil)
+ defer func() { c.Assert(r.Close(), IsNil) }()
+
ar1, err := r.AdvertisedReferences()
c.Assert(err, IsNil)
c.Assert(ar1, NotNil)