diff --git a/test/e2e/autoscaling/autoscaling_timer.go b/test/e2e/autoscaling/autoscaling_timer.go index 56ace55b29..136b2a2361 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) {