sshClient dials the server's SSH port and returns a connected gossh.Client.
(t *testing.T)
| 60 | |
| 61 | // sshClient dials the server's SSH port and returns a connected gossh.Client. |
| 62 | func (e *testSSHEnv) sshClient(t *testing.T) *gossh.Client { |
| 63 | t.Helper() |
| 64 | ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) |
| 65 | defer cancel() |
| 66 | |
| 67 | conn, err := e.client.DialTCPPort(ctx, 22) |
| 68 | if err != nil { |
| 69 | t.Fatalf("DialTCPPort(22): %v", err) |
| 70 | } |
| 71 | sshConn, chans, reqs, err := gossh.NewClientConn(conn, "server", &gossh.ClientConfig{ |
| 72 | HostKeyCallback: gossh.InsecureIgnoreHostKey(), |
| 73 | }) |
| 74 | if err != nil { |
| 75 | conn.Close() |
| 76 | t.Fatalf("NewClientConn: %v", err) |
| 77 | } |
| 78 | c := gossh.NewClient(sshConn, chans, reqs) |
| 79 | t.Cleanup(func() { c.Close() }) |
| 80 | return c |
| 81 | } |
| 82 | |
| 83 | func TestSSHSuite(t *testing.T) { |
| 84 | t.Parallel() |
no test coverage detected