From 9e886ee4f218fc3dcdf33c35cee6e798d61c5b85 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 13 Aug 2014 10:56:59 -0700 Subject: [PATCH] go.crypto/ssh: skip tests that start ssh-agent. Also stops leaking /tmp/ directories. Fixes golang/go#8489. LGTM=dave, minux R=dave, minux, agl CC=golang-codereviews https://golang.org/cl/124010043 --- ssh/agent/client_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ssh/agent/client_test.go b/ssh/agent/client_test.go index d8b0913..03a7faa 100644 --- a/ssh/agent/client_test.go +++ b/ssh/agent/client_test.go @@ -11,13 +11,21 @@ import ( "net" "os" "os/exec" + "path/filepath" "strconv" "testing" "code.google.com/p/go.crypto/ssh" ) +// startAgent executes ssh-agent, and returns a Agent interface to it. func startAgent(t *testing.T) (client Agent, socket string, cleanup func()) { + if testing.Short() { + // ssh-agent is not always available, and the key + // types supported vary by platform. + t.Skip("skipping test due to -short") + } + bin, err := exec.LookPath("ssh-agent") if err != nil { t.Skip("could not find ssh-agent") @@ -66,6 +74,7 @@ func startAgent(t *testing.T) (client Agent, socket string, cleanup func()) { proc.Kill() } conn.Close() + os.RemoveAll(filepath.Dir(socket)) } }