Browse Source

ssh: remove testing.T from ExampleRetryableAuthMethod

Change-Id: I9cb821827b16d60b0a8c4fff9caec78748f3a495
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/171677
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Han-Wen Nienhuys 6 years ago
parent
commit
184a689644
1 changed files with 13 additions and 3 deletions
  1. 13 3
      ssh/client_auth_test.go

+ 13 - 3
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