started tests for ssh; added cover tool

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2015-01-31 16:03:20 -05:00
parent da64d92a74
commit cf14bac2fc
2 changed files with 29 additions and 0 deletions

View File

@ -3,6 +3,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends openssh-client
RUN go get github.com/mitchellh/gox
RUN go get github.com/aktau/github-release
RUN go get github.com/tools/godep
RUN go get code.google.com/p/go.tools/cmd/cover
ENV GOPATH /go/src/github.com/docker/machine/Godeps/_workspace:/go
ENV MACHINE_BINARY /go/src/github.com/docker/machine/docker-machine
WORKDIR /go/src/github.com/docker/machine

28
ssh/ssh_test.go Normal file
View File

@ -0,0 +1,28 @@
package ssh
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
)
func TestGenerateSSHKey(t *testing.T) {
tmpDir, err := ioutil.TempDir("", "machine-test-")
if err != nil {
t.Fatal(err)
}
filename := filepath.Join(tmpDir, "sshkey")
if err := GenerateSSHKey(filename); err != nil {
t.Fatal(err)
}
if _, err := os.Stat(filename); err != nil {
t.Fatalf("expected ssh key at %s", filename)
}
// cleanup
_ = os.RemoveAll(tmpDir)
}