packer-cn/driver/testing/host_acc_test.go

23 lines
511 B
Go
Raw Normal View History

package testing
import (
"testing"
)
func TestHostAcc(t *testing.T) {
initDriverAcceptanceTest(t)
2017-11-08 11:47:29 -05:00
hostName := "esxi-1.vsphere55.test"
d := NewTestDriver(t)
2017-11-08 11:47:29 -05:00
host, err := d.FindHost(hostName)
if err != nil {
2017-11-08 11:47:29 -05:00
t.Fatalf("Cannot find the default host '%v': %v", "datastore1", err)
}
switch info, err := host.Info("name"); {
case err != nil:
2017-10-26 12:15:54 -04:00
t.Errorf("Cannot read host properties: %v", err)
2017-11-08 11:47:29 -05:00
case info.Name != hostName:
t.Errorf("Wrong host name: expected '%v', got: '%v'", hostName, info.Name)
}
}