mirror of https://github.com/docker/docs.git
started tests for ssh; added cover tool
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
da64d92a74
commit
cf14bac2fc
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
Loading…
Reference in New Issue