From 09e2fd952b82d0e024e32c85c54fcee5d7fb8fc9 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Mon, 25 Sep 2023 19:40:02 +0200 Subject: [PATCH] fix test issues Signed-off-by: Jorge Turrado --- pkg/scaling/scale_handler.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/scaling/scale_handler.go b/pkg/scaling/scale_handler.go index 01df98449c4..a2c6622766d 100644 --- a/pkg/scaling/scale_handler.go +++ b/pkg/scaling/scale_handler.go @@ -603,6 +603,9 @@ func (h *scaleHandler) getScaledObjectState(ctx context.Context, scaledObject *k for k, v := range result.Pairs { metricTriggerPairList[k] = v } + for k, v := range result.Records { + metricsRecord[k] = v + } } // invalidate the cache for the ScaledObject, if we hit an error in any scaler @@ -665,7 +668,13 @@ func (*scaleHandler) processScaledObjectStateScaler( logger logr.Logger, scaledObject *kedav1alpha1.ScaledObject, ) ScaledObjectStateScalerResult { - result := ScaledObjectStateScalerResult{} + result := ScaledObjectStateScalerResult{ + IsActive: false, + IsError: false, + Metrics: []external_metrics.ExternalMetricValue{}, + Pairs: map[string]string{}, + Records: map[string]metricscache.MetricsRecord{}, + } scalerName := strings.Replace(fmt.Sprintf("%T", scaler), "*scalers.", "", 1) if scalerConfig.TriggerName != "" {