diff options
Diffstat (limited to 'vendor/golang.org/x/crypto/ssh/agent')
-rw-r--r-- | vendor/golang.org/x/crypto/ssh/agent/client_test.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/vendor/golang.org/x/crypto/ssh/agent/client_test.go b/vendor/golang.org/x/crypto/ssh/agent/client_test.go index 93d3a9cd2..5fc47e577 100644 --- a/vendor/golang.org/x/crypto/ssh/agent/client_test.go +++ b/vendor/golang.org/x/crypto/ssh/agent/client_test.go @@ -180,9 +180,12 @@ func TestCert(t *testing.T) { // therefore is buffered (net.Pipe deadlocks if both sides start with // a write.) func netPipe() (net.Conn, net.Conn, error) { - listener, err := net.Listen("tcp", ":0") + listener, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { - return nil, nil, err + listener, err = net.Listen("tcp", "[::1]:0") + if err != nil { + return nil, nil, err + } } defer listener.Close() c1, err := net.Dial("tcp", listener.Addr().String()) @@ -200,6 +203,9 @@ func netPipe() (net.Conn, net.Conn, error) { } func TestAuth(t *testing.T) { + agent, _, cleanup := startAgent(t) + defer cleanup() + a, b, err := netPipe() if err != nil { t.Fatalf("netPipe: %v", err) @@ -208,9 +214,6 @@ func TestAuth(t *testing.T) { defer a.Close() defer b.Close() - agent, _, cleanup := startAgent(t) - defer cleanup() - if err := agent.Add(AddedKey{PrivateKey: testPrivateKeys["rsa"], Comment: "comment"}); err != nil { t.Errorf("Add: %v", err) } |