func TestNewSetPassword(t *testing.T) {
	unsetSSHAuthSockEnv(t)
	c := testConfig(t)
	c.PrivateKey = ""
	s, err := c.New()
	if err != nil {
		t.Fatalf("Creating new SSH object should succeed, got: %s", err)
	}
	if len(s.(*ssh).auth) != authMethods {
		t.Fatalf("When Password field is set, object should include one auth method")
	}
}
nolint:paralleltest // This test may access SSHAuthSockEnv environment variable,
which is a global variable, so to keep things stable, don't run it in parallel.
package ssh
import (
	"bytes"
	cryptorand "crypto/rand"
	"crypto/rsa"
	"crypto/x509"
	"encoding/pem"
	"fmt"
	"io/ioutil"
	"math/rand"
	"net"
	"os"
	"reflect"
	"strings"
	"testing"
	"time"
	"github.com/google/go-cmp/cmp"
	"github.com/google/uuid"
	gossh "golang.org/x/crypto/ssh"
	"golang.org/x/crypto/ssh/agent"
)
const (
	authMethods = 1
)
func unsetSSHAuthSockEnv(t *testing.T) {
	t.Helper()
	if err := os.Unsetenv(SSHAuthSockEnv); err != nil {
		t.Fatalf("Failed unsetting environment variable %q: %v", SSHAuthSockEnv, err)
	}
}
func TestNew(t *testing.T) {
	unsetSSHAuthSockEnv(t)
	c := testConfig(t)
	if _, err := c.New(); err != nil {
		t.Fatalf("Creating new SSH object should succeed, got: %s", err)
	}
}