From 184a689644f29bf8bdd79031903de428eee310c1 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 11 Apr 2019 09:02:49 +0200 Subject: [PATCH] ssh: remove testing.T from ExampleRetryableAuthMethod Change-Id: I9cb821827b16d60b0a8c4fff9caec78748f3a495 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/171677 Reviewed-by: Brad Fitzpatrick --- ssh/client_auth_test.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ssh/client_auth_test.go b/ssh/client_auth_test.go index 026d137..ae60b9f 100644 --- a/ssh/client_auth_test.go +++ b/ssh/client_auth_test.go @@ -10,6 +10,8 @@ import ( "errors" "fmt" "io" + "log" + "net" "os" "strings" "testing" @@ -477,7 +479,7 @@ func TestRetryableAuth(t *testing.T) { } } -func ExampleRetryableAuthMethod(t *testing.T) { +func ExampleRetryableAuthMethod() { user := "testuser" NumberOfPrompts := 3 @@ -495,9 +497,17 @@ func ExampleRetryableAuthMethod(t *testing.T) { }, } - if err := tryAuth(t, config); err != nil { - t.Fatalf("unable to dial remote side: %s", err) + host := "mysshserver" + netConn, err := net.Dial("tcp", host) + if err != nil { + log.Fatal(err) } + + sshConn, _, _, err := NewClientConn(netConn, host, config) + if err != nil { + log.Fatal(err) + } + _ = sshConn } // Test if username is received on server side when NoClientAuth is used