aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-04-21 14:26:27 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2017-04-21 14:26:27 +0200
commit63bbba6804c1ee5f52897aaedb8e58574b056bb9 (patch)
tree16463dda910015bceea3cfb81f16424d3d370054 /plumbing/transport
parentfa9dd838ee89eaff543cdd81e7c97c842f982538 (diff)
downloadgo-git-63bbba6804c1ee5f52897aaedb8e58574b056bb9.tar.gz
transport: ssh, travis tests
Diffstat (limited to 'plumbing/transport')
-rw-r--r--plumbing/transport/ssh/upload_pack_test.go19
1 files changed, 15 insertions, 4 deletions
diff --git a/plumbing/transport/ssh/upload_pack_test.go b/plumbing/transport/ssh/upload_pack_test.go
index 54d523a..85a3d9d 100644
--- a/plumbing/transport/ssh/upload_pack_test.go
+++ b/plumbing/transport/ssh/upload_pack_test.go
@@ -16,10 +16,7 @@ type UploadPackSuite struct {
var _ = Suite(&UploadPackSuite{})
func (s *UploadPackSuite) SetUpSuite(c *C) {
- if os.Getenv("SSH_AUTH_SOCK") == "" {
- c.Skip("SSH_AUTH_SOCK is not set")
- }
-
+ s.setAuthBuilder(c)
s.UploadPackSuite.Client = DefaultClient
ep, err := transport.NewEndpoint("git@github.com:git-fixtures/basic.git")
@@ -34,3 +31,17 @@ func (s *UploadPackSuite) SetUpSuite(c *C) {
c.Assert(err, IsNil)
s.UploadPackSuite.NonExistentEndpoint = ep
}
+
+func (s *UploadPackSuite) setAuthBuilder(c *C) {
+ privateKey := os.Getenv("SSH_TEST_PRIVATE_KEY")
+ if privateKey != "" {
+ DefaultAuthBuilder = func(user string) (AuthMethod, error) {
+ return NewPublicKeysFromFile(user, privateKey)
+ }
+ }
+
+ if privateKey == "" && os.Getenv("SSH_AUTH_SOCK") == "" {
+ c.Skip("SSH_AUTH_SOCK or SSH_TEST_PRIVATE_KEY are required")
+ return
+ }
+}