2013-12-24 00:58:41 -05:00
|
|
|
package iso
|
2013-11-07 15:28:41 -05:00
|
|
|
|
|
|
|
import (
|
2014-02-13 05:53:47 -05:00
|
|
|
"fmt"
|
2013-12-24 13:31:57 -05:00
|
|
|
vmwcommon "github.com/mitchellh/packer/builder/vmware/common"
|
2014-02-13 05:53:47 -05:00
|
|
|
"net"
|
2013-11-07 15:28:41 -05:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestESX5Driver_implDriver(t *testing.T) {
|
2013-12-24 13:31:57 -05:00
|
|
|
var _ vmwcommon.Driver = new(ESX5Driver)
|
2013-11-07 15:28:41 -05:00
|
|
|
}
|
|
|
|
|
2014-01-01 23:55:08 -05:00
|
|
|
func TestESX5Driver_implOutputDir(t *testing.T) {
|
|
|
|
var _ vmwcommon.OutputDir = new(ESX5Driver)
|
|
|
|
}
|
|
|
|
|
2013-11-07 15:28:41 -05:00
|
|
|
func TestESX5Driver_implRemoteDriver(t *testing.T) {
|
|
|
|
var _ RemoteDriver = new(ESX5Driver)
|
|
|
|
}
|
2014-02-13 05:53:47 -05:00
|
|
|
|
|
|
|
func TestESX5Driver_HostIP(t *testing.T) {
|
2014-02-21 18:11:56 -05:00
|
|
|
expected_host := "127.0.0.1"
|
2014-02-13 05:53:47 -05:00
|
|
|
|
2014-02-21 18:11:56 -05:00
|
|
|
//create mock SSH server
|
2014-02-13 05:53:47 -05:00
|
|
|
listen, _ := net.Listen("tcp", fmt.Sprintf("%s:0", expected_host))
|
|
|
|
port := listen.Addr().(*net.TCPAddr).Port
|
|
|
|
defer listen.Close()
|
|
|
|
|
|
|
|
driver := ESX5Driver{Host: "localhost", Port: uint(port)}
|
|
|
|
|
|
|
|
if host, _ := driver.HostIP(); host != expected_host {
|
|
|
|
t.Error(fmt.Sprintf("Expected string, %s but got %s", expected_host, host))
|
|
|
|
}
|
|
|
|
}
|