diff --git a/config/samples/keda_v1alpha1_triggerauthentication.yaml b/config/samples/keda_v1alpha1_triggerauthentication.yaml index bc4c5840a30..a4733a1d4ac 100644 --- a/config/samples/keda_v1alpha1_triggerauthentication.yaml +++ b/config/samples/keda_v1alpha1_triggerauthentication.yaml @@ -4,6 +4,6 @@ metadata: name: example-triggerauthentication spec: secretTargetRef: - - parameter: exmaple-secret-parameter + - parameter: example-secret-parameter name: example-secret-name key: example-role-key diff --git a/pkg/fallback/fallback_test.go b/pkg/fallback/fallback_test.go index 36344cd7d47..5b23aab8228 100644 --- a/pkg/fallback/fallback_test.go +++ b/pkg/fallback/fallback_test.go @@ -110,7 +110,7 @@ var _ = Describe("fallback", func() { }) It("should propagate the error when fallback is disabled", func() { - scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error")) + scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error")) so := buildScaledObject(nil, nil) metricSpec := createMetricSpec(3) @@ -120,11 +120,11 @@ var _ = Describe("fallback", func() { _, _, err = GetMetricsWithFallback(context.Background(), client, metrics, err, metricName, so, metricSpec) Expect(err).ShouldNot(BeNil()) - Expect(err.Error()).Should(Equal("Some error")) + Expect(err.Error()).Should(Equal("some error")) }) It("should bump the number of failures when metrics call fails", func() { - scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error")) + scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error")) startingNumberOfFailures := int32(0) so := buildScaledObject( @@ -149,12 +149,12 @@ var _ = Describe("fallback", func() { _, _, err = GetMetricsWithFallback(context.Background(), client, metrics, err, metricName, so, metricSpec) Expect(err).ShouldNot(BeNil()) - Expect(err.Error()).Should(Equal("Some error")) + Expect(err.Error()).Should(Equal("some error")) Expect(so.Status.Health[metricName]).To(haveFailureAndStatus(1, kedav1alpha1.HealthStatusFailing)) }) It("should return a normalised metric when number of failures are beyond threshold", func() { - scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error")) + scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error")) startingNumberOfFailures := int32(3) expectedMetricValue := float64(100) @@ -207,7 +207,7 @@ var _ = Describe("fallback", func() { }) It("should ignore error if we fail to update kubernetes status", func() { - scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error")) + scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error")) startingNumberOfFailures := int32(3) expectedMetricValue := float64(100) @@ -228,7 +228,7 @@ var _ = Describe("fallback", func() { metricSpec := createMetricSpec(10) statusWriter := mock_client.NewMockStatusWriter(ctrl) - statusWriter.EXPECT().Patch(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("Some error")) + statusWriter.EXPECT().Patch(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("some error")) client.EXPECT().Status().Return(statusWriter) metrics, _, err := scaler.GetMetricsAndActivity(context.Background(), metricName) @@ -241,7 +241,7 @@ var _ = Describe("fallback", func() { }) It("should return error when fallback is enabled but scaledobject has invalid parameter", func() { - scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error")) + scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error")) startingNumberOfFailures := int32(3) so := buildScaledObject( @@ -265,11 +265,11 @@ var _ = Describe("fallback", func() { _, _, err = GetMetricsWithFallback(context.Background(), client, metrics, err, metricName, so, metricSpec) Expect(err).ShouldNot(BeNil()) - Expect(err.Error()).Should(Equal("Some error")) + Expect(err.Error()).Should(Equal("some error")) }) It("should set the fallback condition when a fallback exists in the scaled object", func() { - scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error")) + scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error")) startingNumberOfFailures := int32(3) failingNumberOfFailures := int32(6) anotherMetricName := "another metric name" @@ -303,7 +303,7 @@ var _ = Describe("fallback", func() { }) It("should set the fallback condition to false if the config is invalid", func() { - scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error")) + scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error")) startingNumberOfFailures := int32(3) failingNumberOfFailures := int32(6) anotherMetricName := "another metric name" @@ -332,7 +332,7 @@ var _ = Describe("fallback", func() { metrics, _, err := scaler.GetMetricsAndActivity(context.Background(), metricName) _, _, err = GetMetricsWithFallback(context.Background(), client, metrics, err, metricName, so, metricSpec) Expect(err).ShouldNot(BeNil()) - Expect(err.Error()).Should(Equal("Some error")) + Expect(err.Error()).Should(Equal("some error")) condition := so.Status.Conditions.GetFallbackCondition() Expect(condition.IsTrue()).Should(BeFalse()) }) diff --git a/pkg/metricscollector/opentelemetry.go b/pkg/metricscollector/opentelemetry.go index ae3d00f1cb0..97a811ef9ee 100644 --- a/pkg/metricscollector/opentelemetry.go +++ b/pkg/metricscollector/opentelemetry.go @@ -379,7 +379,7 @@ func (o *OtelMetrics) RecordCloudEventEmitted(namespace string, cloudeventsource otCloudEventEmittedCounter.Add(context.Background(), 1, opt) } -// RecordCloudEventEmitted counts the number of errors occurred in trying emit cloudevent +// RecordCloudEventEmittedError counts the number of errors occurred in trying emit cloudevent func (o *OtelMetrics) RecordCloudEventEmittedError(namespace string, cloudeventsource string, eventsink string) { opt := api.WithAttributes( attribute.Key("namespace").String(namespace), @@ -398,7 +398,7 @@ func CloudeventQueueStatusCallback(_ context.Context, obsrv api.Float64Observer) return nil } -// RecordCloudEventSourceQueueStatus record the number of cloudevents that are waiting for emitting +// RecordCloudEventQueueStatus record the number of cloudevents that are waiting for emitting func (o *OtelMetrics) RecordCloudEventQueueStatus(namespace string, value int) { opt := api.WithAttributes( attribute.Key("namespace").String(namespace), diff --git a/pkg/metricscollector/prommetrics.go b/pkg/metricscollector/prommetrics.go index 6bbac8239be..29bf749fe76 100644 --- a/pkg/metricscollector/prommetrics.go +++ b/pkg/metricscollector/prommetrics.go @@ -325,7 +325,7 @@ func (p *PromMetrics) RecordCloudEventEmittedError(namespace string, cloudevents cloudeventEmitted.With(labels).Inc() } -// RecordCloudEventSourceQueueStatus record the number of cloudevents that are waiting for emitting +// RecordCloudEventQueueStatus record the number of cloudevents that are waiting for emitting func (p *PromMetrics) RecordCloudEventQueueStatus(namespace string, value int) { cloudeventQueueStatus.With(prometheus.Labels{"namespace": namespace}).Set(float64(value)) }