From bee266008e047350ea26594ca019dfc50176c34f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 20 May 2013 15:52:34 -0700 Subject: [PATCH] communicator/ssh: Ensure valid communicator --- communicator/ssh/communicator.go | 9 +++++++++ communicator/ssh/communicator_test.go | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/communicator/ssh/communicator.go b/communicator/ssh/communicator.go index 37158b4f0..ae73f41d1 100644 --- a/communicator/ssh/communicator.go +++ b/communicator/ssh/communicator.go @@ -4,6 +4,7 @@ import ( "bytes" "code.google.com/p/go.crypto/ssh" "github.com/mitchellh/packer/packer" + "io" "log" "net" ) @@ -70,3 +71,11 @@ func (c *comm) Start(cmd string) (remote *packer.RemoteCommand, err error) { return } + +func (c *comm) Upload(string, io.Reader) error { + return nil +} + +func (c *comm) Download(string, io.Writer) error { + return nil +} diff --git a/communicator/ssh/communicator_test.go b/communicator/ssh/communicator_test.go index 8e246933a..5dd424bab 100644 --- a/communicator/ssh/communicator_test.go +++ b/communicator/ssh/communicator_test.go @@ -3,6 +3,7 @@ package ssh import ( "bytes" "code.google.com/p/go.crypto/ssh" + "github.com/mitchellh/packer/packer" "fmt" "net" "strings" @@ -132,6 +133,14 @@ func newMockLineServer(t *testing.T) string { return l.Addr().String() } +func TestCommIsCommunicator(t *testing.T) { + var raw interface{} + raw = &comm{} + if _, ok := raw.(packer.Communicator); !ok { + t.Fatalf("comm must be a communicator") + } +} + func TestNew_Invalid(t *testing.T) { clientConfig := &ssh.ClientConfig{ User: "user",