From e2ff63103df86253641d6ddf9917f35c7718d000 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Fri, 23 Feb 2024 09:12:11 -0500 Subject: [PATCH] fix for persistent Horizontal pod autoscaling failures Signed-off-by: Davanum Srinivas --- .../autoscaling/custom_metrics_stackdriver_autoscaling.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/e2e/autoscaling/custom_metrics_stackdriver_autoscaling.go b/test/e2e/autoscaling/custom_metrics_stackdriver_autoscaling.go index 78f4953d73a..f587fbe2825 100644 --- a/test/e2e/autoscaling/custom_metrics_stackdriver_autoscaling.go +++ b/test/e2e/autoscaling/custom_metrics_stackdriver_autoscaling.go @@ -20,6 +20,7 @@ import ( "context" "fmt" "math" + "strings" "time" gcm "google.golang.org/api/monitoring/v3" @@ -614,7 +615,7 @@ func ensureDesiredReplicasInRange(ctx context.Context, deploymentName, namespace err := wait.PollUntilContextTimeout(ctx, interval, timeout, true, func(ctx context.Context) (bool, error) { deployment, err := cs.AppsV1().Deployments(namespace).Get(ctx, deploymentName, metav1.GetOptions{}) if err != nil { - framework.Failf("Failed to get replication controller %s: %v", deployment, err) + return true, err } replicas := int(deployment.Status.ReadyReplicas) framework.Logf("expecting there to be in [%d, %d] replicas (are: %d)", minDesiredReplicas, maxDesiredReplicas, replicas) @@ -627,7 +628,7 @@ func ensureDesiredReplicasInRange(ctx context.Context, deploymentName, namespace } }) // The call above always returns an error, but if it is timeout, it's OK (condition satisfied all the time). - if wait.Interrupted(err) { + if wait.Interrupted(err) || strings.Contains(err.Error(), "would exceed context deadline") { framework.Logf("Number of replicas was stable over %v", timeout) return }