communicator/ssh: Ensure valid communicator

This commit is contained in:
Mitchell Hashimoto 2013-05-20 15:52:34 -07:00
parent 6d3e7e9964
commit bee266008e
2 changed files with 18 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"code.google.com/p/go.crypto/ssh" "code.google.com/p/go.crypto/ssh"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"io"
"log" "log"
"net" "net"
) )
@ -70,3 +71,11 @@ func (c *comm) Start(cmd string) (remote *packer.RemoteCommand, err error) {
return return
} }
func (c *comm) Upload(string, io.Reader) error {
return nil
}
func (c *comm) Download(string, io.Writer) error {
return nil
}

View File

@ -3,6 +3,7 @@ package ssh
import ( import (
"bytes" "bytes"
"code.google.com/p/go.crypto/ssh" "code.google.com/p/go.crypto/ssh"
"github.com/mitchellh/packer/packer"
"fmt" "fmt"
"net" "net"
"strings" "strings"
@ -132,6 +133,14 @@ func newMockLineServer(t *testing.T) string {
return l.Addr().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) { func TestNew_Invalid(t *testing.T) {
clientConfig := &ssh.ClientConfig{ clientConfig := &ssh.ClientConfig{
User: "user", User: "user",