mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2025-05-11 16:10:40 +00:00
add test for end date in incorrect format
Signed-off-by: zlawrence <zak.lawrence@zalando.de>
This commit is contained in:
@ -331,7 +331,7 @@ func calculateMetrics(spec v1.ScalingScheduleSpec, defaultScalingWindow time.Dur
|
||||
}
|
||||
|
||||
// If no end time was provided, set it to equal the start time
|
||||
if schedule.EndDate == nil || *schedule.EndDate == "" {
|
||||
if schedule.EndDate == nil || string(*schedule.EndDate) == "" {
|
||||
scheduledEndTime = scheduledTime
|
||||
} else {
|
||||
scheduledEndTime, err = time.Parse(time.RFC3339, string(*schedule.EndDate))
|
||||
|
@ -249,6 +249,19 @@ func TestScalingScheduleCollector(t *testing.T) {
|
||||
},
|
||||
err: ErrInvalidScheduleDate,
|
||||
},
|
||||
{
|
||||
msg: "Return error for one time config end date not in RFC3339 format",
|
||||
schedules: []schedule{
|
||||
{
|
||||
date: nowTime.Add(-time.Minute * 20).Format(time.RFC3339),
|
||||
endDate: nowTime.Add(1 * time.Hour).Format(time.RFC822),
|
||||
kind: "OneTime",
|
||||
duration: 15,
|
||||
value: 100,
|
||||
},
|
||||
},
|
||||
err: ErrInvalidScheduleDate,
|
||||
},
|
||||
{
|
||||
msg: "Return the right value for two one time config",
|
||||
schedules: []schedule{
|
||||
|
Reference in New Issue
Block a user