github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/util/clissh/ssh_suite_test.go (about)

     1  package clissh_test
     2  
     3  import (
     4  	"io/ioutil"
     5  	"path/filepath"
     6  	"time"
     7  
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  	"golang.org/x/crypto/ssh"
    11  
    12  	"testing"
    13  )
    14  
    15  var (
    16  	TestHostKey    ssh.Signer
    17  	TestPrivateKey ssh.Signer
    18  )
    19  
    20  func TestCmd(t *testing.T) {
    21  	RegisterFailHandler(Fail)
    22  	RunSpecs(t, "CLI SSH Suite")
    23  }
    24  
    25  var _ = BeforeSuite(func() {
    26  	SetDefaultEventuallyTimeout(3 * time.Second)
    27  
    28  	hostKeyBytes, err := ioutil.ReadFile(filepath.Join("..", "..", "fixtures", "host-key"))
    29  	Expect(err).NotTo(HaveOccurred())
    30  	hostKey, err := ssh.ParsePrivateKey(hostKeyBytes)
    31  	Expect(err).NotTo(HaveOccurred())
    32  
    33  	privateKeyBytes, err := ioutil.ReadFile(filepath.Join("..", "..", "fixtures", "private-key"))
    34  	Expect(err).NotTo(HaveOccurred())
    35  	privateKey, err := ssh.ParsePrivateKey(privateKeyBytes)
    36  	Expect(err).NotTo(HaveOccurred())
    37  
    38  	TestHostKey = hostKey
    39  	TestPrivateKey = privateKey
    40  })