cluster size autoscaling tests fixes

pull/6/head
Aleksandra Malinowska 2017-09-26 10:57:59 +02:00
parent b188868fd9
commit fe161ffa11
1 changed files with 8 additions and 4 deletions

View File

@ -623,11 +623,12 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
// Determine whether we want to run & adjust the setup if necessary // Determine whether we want to run & adjust the setup if necessary
if len(originalSizes) < 2 { if len(originalSizes) < 2 {
if framework.ProviderIs("gke") { if framework.ProviderIs("gke") {
By("Adding a new node pool")
const extraPoolName = "extra-pool" const extraPoolName = "extra-pool"
addNodePool(extraPoolName, "n1-standard-4", 1) addNodePool(extraPoolName, "n1-standard-4", 1)
defer deleteNodePool(extraPoolName) defer deleteNodePool(extraPoolName)
err := enableAutoscaler(extraPoolName, 0, 1) framework.ExpectNoError(framework.WaitForReadyNodes(c, nodeCount+1, resizeTimeout))
framework.ExpectNoError(err) framework.ExpectNoError(enableAutoscaler(extraPoolName, 0, 1))
} else { } else {
framework.Skipf("At least 2 node groups are needed for scale-to-0 tests") framework.Skipf("At least 2 node groups are needed for scale-to-0 tests")
} }
@ -831,12 +832,15 @@ func enableAutoscaler(nodePool string, minCount, maxCount int) error {
glog.Infof("Config update result: %s", putResult) glog.Infof("Config update result: %s", putResult)
} }
var finalErr error
for startTime := time.Now(); startTime.Add(gkeUpdateTimeout).After(time.Now()); time.Sleep(30 * time.Second) { for startTime := time.Now(); startTime.Add(gkeUpdateTimeout).After(time.Now()); time.Sleep(30 * time.Second) {
if val, err := isAutoscalerEnabled(minCount); err == nil && val { val, err := isAutoscalerEnabled(minCount)
if err == nil && val {
return nil return nil
} }
finalErr = err
} }
return fmt.Errorf("autoscaler not enabled") return fmt.Errorf("autoscaler not enabled, last error: %v", finalErr)
} }
func disableAutoscaler(nodePool string, minCount, maxCount int) error { func disableAutoscaler(nodePool string, minCount, maxCount int) error {