Skip to content

Commit

Permalink
Adding changelog and modifying test case for no value response
Browse files Browse the repository at this point in the history
  • Loading branch information
Althaf Mohamed committed Nov 25, 2021
1 parent 253403e commit 0508942
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- ScaledJob: introduce `RolloutStrategy` ([#2164](https://github.com/kedacore/keda/pull/2164))
- Add ScalersCache to reuse scalers unless they need changing ([#2187](https://github.com/kedacore/keda/pull/2187))
- Cache metric names provided by KEDA Metrics Server ([#2279](https://github.com/kedacore/keda/pull/2279))
- Return minimum value for the metric and log, when cloudwatch returns empty list of metrics ([#2345](https://github.com/kedacore/keda/pull/2345))

### Improvements

Expand Down
20 changes: 18 additions & 2 deletions pkg/scalers/aws_cloudwatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,23 @@ var awsCloudwatchGetMetricTestData = []awsCloudwatchMetadata{
},
{
namespace: "Custom",
metricsName: "Error",
metricsName: testAWSCloudwatchErrorMetric,
dimensionName: []string{"DIM"},
dimensionValue: []string{"DIM_VALUE"},
targetMetricValue: 100,
minMetricValue: 0,
metricCollectionTime: 60,
metricStat: "Average",
metricUnit: "",
metricStatPeriod: 60,
metricEndTimeOffset: 60,
awsRegion: "us-west-2",
awsAuthorization: awsAuthorizationMetadata{podIdentityOwner: false},
scalerIndex: 0,
},
{
namespace: "Custom",
metricsName: testAWSCloudwatchNoValueMetric,
dimensionName: []string{"DIM"},
dimensionValue: []string{"DIM_VALUE"},
targetMetricValue: 100,
Expand Down Expand Up @@ -436,7 +452,7 @@ func TestAWSCloudwatchScalerGetMetrics(t *testing.T) {
case testAWSCloudwatchErrorMetric:
assert.Error(t, err, "expect error because of cloudwatch api error")
case testAWSCloudwatchNoValueMetric:
assert.Error(t, err, "expect error because of no data return from cloudwatch")
assert.NoError(t,err, "dont expect error when returning empty metric list from cloudwatch")
default:
assert.EqualValues(t, int64(10.0), value[0].Value.Value())
}
Expand Down

0 comments on commit 0508942

Please sign in to comment.