Add TestZone()

This commit is contained in:
jiatongw 2018-08-06 15:19:10 -07:00
parent 5c44fd871f
commit af5084ea75

View File

@ -315,17 +315,21 @@ func TestVSphereLoginWithCaCert(t *testing.T) {
} }
func TestZones(t *testing.T) { func TestZones(t *testing.T) {
cfg := VSphereConfig{}
cfg.Global.Datacenter = "myDatacenter"
// Create vSphere configuration object // Create vSphere configuration object
cfg, ok := configFromEnv()
vs := VSphere{ vs := VSphere{
cfg: &cfg, cfg: &cfg,
} }
if !ok {
_, ok := vs.Zones() t.Skipf("No config found in environment")
if ok { }
t.Fatalf("Zones() returned true") _, err := vs.GetZone(context.TODO())
if err != nil {
t.Fatalf("GetZone() failed: %s", err)
}
_, ok = vs.Zones()
if !ok {
t.Fatalf("Zones() returned false")
} }
} }