packer-cn/builder/vmware/iso/driver_esx5_test.go

36 lines
830 B
Go
Raw Normal View History

2013-12-24 00:58:41 -05:00
package iso
import (
"fmt"
2013-12-24 13:31:57 -05:00
vmwcommon "github.com/mitchellh/packer/builder/vmware/common"
"net"
"testing"
)
func TestESX5Driver_implDriver(t *testing.T) {
2013-12-24 13:31:57 -05:00
var _ vmwcommon.Driver = new(ESX5Driver)
}
func TestESX5Driver_implOutputDir(t *testing.T) {
var _ vmwcommon.OutputDir = new(ESX5Driver)
}
func TestESX5Driver_implRemoteDriver(t *testing.T) {
var _ RemoteDriver = new(ESX5Driver)
}
func TestESX5Driver_HostIP(t *testing.T) {
2014-02-21 18:11:56 -05:00
expected_host := "127.0.0.1"
2014-02-21 18:11:56 -05:00
//create mock SSH server
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))
}
}