go.crypto/ssh: fix tests with -cpu 1,2.
When running the ssh tests several times (e.g. with -cpu 1,2), the second run would fail because testing globals had been altered. This change avoids altering the globals since the default worked anyway. Fixes golang/go#4715. R=golang-dev, minux.ma CC=golang-dev https://golang.org/cl/7903045
This commit is contained in:
+1
-7
@@ -22,12 +22,6 @@ type serverType func(*serverChan, *testing.T)
|
|||||||
|
|
||||||
// dial constructs a new test server and returns a *ClientConn.
|
// dial constructs a new test server and returns a *ClientConn.
|
||||||
func dial(handler serverType, t *testing.T) *ClientConn {
|
func dial(handler serverType, t *testing.T) *ClientConn {
|
||||||
pw := password("tiger")
|
|
||||||
serverConfig.PasswordCallback = func(conn *ServerConn, user, pass string) bool {
|
|
||||||
return user == "testuser" && pass == string(pw)
|
|
||||||
}
|
|
||||||
serverConfig.PublicKeyCallback = nil
|
|
||||||
|
|
||||||
l, err := Listen("tcp", "127.0.0.1:0", serverConfig)
|
l, err := Listen("tcp", "127.0.0.1:0", serverConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to listen: %v", err)
|
t.Fatalf("unable to listen: %v", err)
|
||||||
@@ -74,7 +68,7 @@ func dial(handler serverType, t *testing.T) *ClientConn {
|
|||||||
config := &ClientConfig{
|
config := &ClientConfig{
|
||||||
User: "testuser",
|
User: "testuser",
|
||||||
Auth: []ClientAuth{
|
Auth: []ClientAuth{
|
||||||
ClientAuthPassword(pw),
|
ClientAuthPassword(clientPassword),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user