package infra import ( "testing" ) func sshTestConn() SSHConn { return SSHConn{ Host: "organic-machine.com", User: "ubuntu", KeyPath: "/home/lucas/.ssh/organic-machine", } } func skipIfNoSSH(t *testing.T) SSHConn { t.Helper() conn := sshTestConn() if err := SSHCheck(conn); err != nil { t.Skipf("SSH no disponible: %v", err) } return conn } func TestSSHCheck(t *testing.T) { t.Run("conecta a organic-machine", func(t *testing.T) { conn := sshTestConn() err := SSHCheck(conn) if err != nil { t.Skipf("SSH no disponible: %v", err) } }) t.Run("falla con host inexistente", func(t *testing.T) { conn := SSHConn{Host: "192.0.2.1", Port: 22, User: "nobody"} err := SSHCheck(conn) if err == nil { t.Error("esperaba error con host inexistente") } }) }