From 73a1227f39088819235b83206bd219a5ec02be2c Mon Sep 17 00:00:00 2001 From: Aleksandra Malinowska Date: Mon, 9 Oct 2017 11:34:44 +0200 Subject: [PATCH] Avoid unnecessary gcloud call if test was skipped --- test/e2e/autoscaling/autoscaling_timer.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/e2e/autoscaling/autoscaling_timer.go b/test/e2e/autoscaling/autoscaling_timer.go index 56ace55b29c..136b2a23610 100644 --- a/test/e2e/autoscaling/autoscaling_timer.go +++ b/test/e2e/autoscaling/autoscaling_timer.go @@ -68,9 +68,13 @@ var _ = SIGDescribe("[Feature:ClusterSizeAutoscalingScaleUp] [Slow] Autoscaling" }) AfterEach(func() { - // Scale down back to only 'nodesNum' nodes, as expected at the start of the test. - framework.ExpectNoError(framework.ResizeGroup(nodeGroupName, nodesNum)) - framework.ExpectNoError(framework.WaitForReadyNodes(f.ClientSet, nodesNum, 15*time.Minute)) + // Attempt cleanup only if a node group was targeted for scale up. + // Otherwise the test was probably skipped and we'll get a gcloud error due to invalid parameters. + if len(nodeGroupName) > 0 { + // Scale down back to only 'nodesNum' nodes, as expected at the start of the test. + framework.ExpectNoError(framework.ResizeGroup(nodeGroupName, nodesNum)) + framework.ExpectNoError(framework.WaitForReadyNodes(f.ClientSet, nodesNum, 15*time.Minute)) + } }) Measure("takes less than 15 minutes", func(b Benchmarker) {