make sure remote_test.go does not run if pem file is not available

This commit is contained in:
travisturner 2014-04-02 09:56:56 -05:00
parent 1d3d7ca400
commit 60423735af

View file

@ -14,7 +14,7 @@ func TestRemote(t *testing.T) {
Convey("Login", t, func() {
pem_file := "id_dsa"
if _, err := os.Stat(pem_file); err == nil {
ssh, err := New("50.16.204.123:22", "todd", "id_dsa")
ssh, err := New("50.16.204.123:22", "todd", pem_file)
So(err, ShouldEqual, nil)
err = ssh.Launch("sleep 10 && date", "background")
So(err, ShouldEqual, nil)
@ -26,15 +26,21 @@ func TestRemote(t *testing.T) {
ok := bytes.Equal([]byte(content), out.Bytes())
So(ok, ShouldEqual, true)
} else {
fmt.Println("No credentials so SSH Test ignored")
fmt.Println("No credentials to SSH. Test ignored.")
So(true, ShouldEqual, true)
}
})
Convey("BigFile", t, func() {
ssh, _ := New("50.16.204.123:22", "todd", "id_dsa")
pem_file := "id_dsa"
if _, err := os.Stat(pem_file); err == nil {
ssh, _ := New("50.16.204.123:22", "todd", pem_file)
ssh.SimpleFileCopyTo("outbin", "tb")
ssh.SimpleFileCopyFrom("tb", "outbin2")
ssh.SimpleFileCopyTo("outbin", "tb")
ssh.SimpleFileCopyFrom("tb", "outbin2")
} else {
fmt.Println("No credentials to SSH. Test ignored.")
So(true, ShouldEqual, true)
}
})
}