github.com/sneal/packer@v0.5.2/builder/vmware/iso/driver_esx5_test.go (about)

     1  package iso
     2  
     3  import (
     4  	"fmt"
     5  	vmwcommon "github.com/mitchellh/packer/builder/vmware/common"
     6  	"net"
     7  	"testing"
     8  )
     9  
    10  func TestESX5Driver_implDriver(t *testing.T) {
    11  	var _ vmwcommon.Driver = new(ESX5Driver)
    12  }
    13  
    14  func TestESX5Driver_implOutputDir(t *testing.T) {
    15  	var _ vmwcommon.OutputDir = new(ESX5Driver)
    16  }
    17  
    18  func TestESX5Driver_implRemoteDriver(t *testing.T) {
    19  	var _ RemoteDriver = new(ESX5Driver)
    20  }
    21  
    22  func TestESX5Driver_HostIP(t *testing.T) {
    23  	expected_host := "127.0.0.1"
    24  
    25  	//create mock SSH server
    26  	listen, _ := net.Listen("tcp", fmt.Sprintf("%s:0", expected_host))
    27  	port := listen.Addr().(*net.TCPAddr).Port
    28  	defer listen.Close()
    29  
    30  	driver := ESX5Driver{Host: "localhost", Port: uint(port)}
    31  
    32  	if host, _ := driver.HostIP(); host != expected_host {
    33  		t.Error(fmt.Sprintf("Expected string, %s but got %s", expected_host, host))
    34  	}
    35  }