Skip to content

Commit

Permalink
typo: fix some typos (#5508)
Browse files Browse the repository at this point in the history
Signed-off-by: googs1025 <[email protected]>
  • Loading branch information
googs1025 authored Feb 14, 2024
1 parent 4da3a5b commit 8bfd635
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion config/samples/keda_v1alpha1_triggerauthentication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 12 additions & 12 deletions pkg/fallback/fallback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(
Expand All @@ -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)

Expand Down Expand Up @@ -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)

Expand All @@ -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)
Expand All @@ -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(
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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())
})
Expand Down
4 changes: 2 additions & 2 deletions pkg/metricscollector/opentelemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion pkg/metricscollector/prommetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

0 comments on commit 8bfd635

Please sign in to comment.