From fe76c9f779b9d8a8c2f4df40e203cfcb7a24860c Mon Sep 17 00:00:00 2001 From: Cheng Xing Date: Thu, 15 Mar 2018 15:00:13 -0700 Subject: [PATCH] Fixes 'Zone is empty' errors in PD upgrade tests; skips pd tests with inline volume in multizone clusters --- test/e2e/framework/pv_util.go | 8 ++++++++ test/e2e/framework/util.go | 10 ++++++++++ test/e2e/storage/pd.go | 2 ++ 3 files changed, 20 insertions(+) diff --git a/test/e2e/framework/pv_util.go b/test/e2e/framework/pv_util.go index 44c96410667..01864f7e9c7 100644 --- a/test/e2e/framework/pv_util.go +++ b/test/e2e/framework/pv_util.go @@ -708,6 +708,14 @@ func createPD(zone string) (string, error) { return "", err } + if zone == "" && TestContext.CloudConfig.MultiZone { + zones, err := gceCloud.GetAllZonesFromCloudProvider() + if err != nil { + return "", err + } + zone, _ = zones.PopAny() + } + tags := map[string]string{} err = gceCloud.CreateDisk(pdName, gcecloud.DiskTypeSSD, zone, 10 /* sizeGb */, tags) if err != nil { diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index d3018951697..c596a0d5d8a 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -348,6 +348,16 @@ func SkipUnlessMultizone(c clientset.Interface) { } } +func SkipIfMultizone(c clientset.Interface) { + zones, err := GetClusterZones(c) + if err != nil { + Skipf("Error listing cluster zones") + } + if zones.Len() > 1 { + Skipf("Requires more than one zone") + } +} + func SkipUnlessClusterMonitoringModeIs(supportedMonitoring ...string) { if !ClusterMonitoringModeIs(supportedMonitoring...) { Skipf("Only next monitoring modes are supported %v (not %s)", supportedMonitoring, TestContext.ClusterMonitoringMode) diff --git a/test/e2e/storage/pd.go b/test/e2e/storage/pd.go index 08c85cfd06b..e67086fd5a4 100644 --- a/test/e2e/storage/pd.go +++ b/test/e2e/storage/pd.go @@ -70,6 +70,8 @@ var _ = utils.SIGDescribe("Pod Disks", func() { cs = f.ClientSet ns = f.Namespace.Name + framework.SkipIfMultizone(cs) + podClient = cs.CoreV1().Pods(ns) nodeClient = cs.CoreV1().Nodes() nodes = framework.GetReadySchedulableNodesOrDie(cs)