From 60423735af99c3a78262819b474e858de5e93b59 Mon Sep 17 00:00:00 2001 From: travisturner Date: Wed, 2 Apr 2014 09:56:56 -0500 Subject: [PATCH] make sure remote_test.go does not run if pem file is not available --- remote/remote_test.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/remote/remote_test.go b/remote/remote_test.go index 2d809506b..1efb53240 100644 --- a/remote/remote_test.go +++ b/remote/remote_test.go @@ -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) + } }) }