(t *testing.T, addr string)
| 491 | } |
| 492 | |
| 493 | func sshClient(t *testing.T, addr string) *ssh.Client { |
| 494 | conn, err := net.Dial("tcp", addr) |
| 495 | require.NoError(t, err) |
| 496 | t.Cleanup(func() { |
| 497 | _ = conn.Close() |
| 498 | }) |
| 499 | |
| 500 | sshConn, channels, requests, err := ssh.NewClientConn(conn, "localhost:22", &ssh.ClientConfig{ |
| 501 | HostKeyCallback: ssh.InsecureIgnoreHostKey(), //nolint:gosec // This is a test. |
| 502 | }) |
| 503 | require.NoError(t, err) |
| 504 | t.Cleanup(func() { |
| 505 | _ = sshConn.Close() |
| 506 | }) |
| 507 | c := ssh.NewClient(sshConn, channels, requests) |
| 508 | t.Cleanup(func() { |
| 509 | _ = c.Close() |
| 510 | }) |
| 511 | return c |
| 512 | } |
no test coverage detected