Check error from gomega
Signed-off-by: James Sturtevant <jstur@microsoft.com>
This commit is contained in:
@@ -507,16 +507,18 @@ func (rc *ResourceConsumer) WaitForReplicas(ctx context.Context, desiredReplicas
|
|||||||
// EnsureDesiredReplicasInRange ensure the replicas is in a desired range
|
// EnsureDesiredReplicasInRange ensure the replicas is in a desired range
|
||||||
func (rc *ResourceConsumer) EnsureDesiredReplicasInRange(ctx context.Context, minDesiredReplicas, maxDesiredReplicas int, duration time.Duration, hpaName string) {
|
func (rc *ResourceConsumer) EnsureDesiredReplicasInRange(ctx context.Context, minDesiredReplicas, maxDesiredReplicas int, duration time.Duration, hpaName string) {
|
||||||
interval := 10 * time.Second
|
interval := 10 * time.Second
|
||||||
framework.Gomega().Consistently(ctx, func(ctx context.Context) int {
|
desiredReplicasErr := framework.Gomega().Consistently(ctx, func(ctx context.Context) int {
|
||||||
return rc.GetReplicas(ctx)
|
return rc.GetReplicas(ctx)
|
||||||
}).WithTimeout(duration).WithPolling(interval).Should(gomega.And(gomega.BeNumerically(">=", minDesiredReplicas), gomega.BeNumerically("<=", maxDesiredReplicas)))
|
}).WithTimeout(duration).WithPolling(interval).Should(gomega.And(gomega.BeNumerically(">=", minDesiredReplicas), gomega.BeNumerically("<=", maxDesiredReplicas)))
|
||||||
|
|
||||||
|
// dump HPA for debugging
|
||||||
as, err := rc.GetHpa(ctx, hpaName)
|
as, err := rc.GetHpa(ctx, hpaName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
framework.Logf("Error getting HPA: %s", err)
|
framework.Logf("Error getting HPA: %s", err)
|
||||||
} else {
|
} else {
|
||||||
framework.Logf("HPA status: %+v", as.Status)
|
framework.Logf("HPA status: %+v", as.Status)
|
||||||
}
|
}
|
||||||
|
framework.ExpectNoError(desiredReplicasErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pause stops background goroutines responsible for consuming resources.
|
// Pause stops background goroutines responsible for consuming resources.
|
||||||
|
Reference in New Issue
Block a user