Check empty zone after the validation of providers

This make sure the testcase that cannot run locally will be skipped
instead of throwing the misleading failure message.

Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
Dave Chen 2021-06-08 13:47:58 +08:00
parent 2cefcc6be7
commit 8d0936b743

View File

@ -351,6 +351,10 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() {
continue
}
if zone, ok := test.Parameters["zone"]; ok {
framework.ExpectNotEqual(len(zone), 0, "expect at least one zone")
}
ginkgo.By("Testing " + test.Name)
suffix := fmt.Sprintf("%d", i)
test.Client = c
@ -1061,9 +1065,11 @@ func deleteProvisionedVolumesAndDisks(c clientset.Interface, pvs []*v1.Persisten
func getRandomClusterZone(c clientset.Interface) string {
zones, err := e2enode.GetClusterZones(c)
zone := ""
framework.ExpectNoError(err)
framework.ExpectNotEqual(len(zones), 0)
zonesList := zones.UnsortedList()
return zonesList[rand.Intn(zones.Len())]
if len(zones) != 0 {
zonesList := zones.UnsortedList()
zone = zonesList[rand.Intn(zones.Len())]
}
return zone
}