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) {
cfg := VSphereConfig{}
cfg.Global.Datacenter = "myDatacenter"
// Create vSphere configuration object
cfg, ok := configFromEnv()
vs := VSphere{
cfg: &cfg,
}
_, ok := vs.Zones()
if ok {
t.Fatalf("Zones() returned true")
if !ok {
t.Skipf("No config found in environment")
}
_, err := vs.GetZone(context.TODO())
if err != nil {
t.Fatalf("GetZone() failed: %s", err)
}
_, ok = vs.Zones()
if !ok {
t.Fatalf("Zones() returned false")
}
}