Do not list CronJob unmet starting times beyond deadline

This commit is contained in:
peay
2017-01-07 16:06:02 -05:00
parent de59ede6b2
commit d141a43d86
3 changed files with 71 additions and 10 deletions

View File

@@ -367,7 +367,7 @@ func TestGetRecentUnmetScheduleTimes(t *testing.T) {
}
}
{
// Case 6: now is way way ahead of last start time.
// Case 6: now is way way ahead of last start time, and there is no deadline.
sj.ObjectMeta.CreationTimestamp = metav1.Time{Time: T1.Add(-2 * time.Hour)}
sj.Status.LastScheduleTime = &metav1.Time{Time: T1.Add(-1 * time.Hour)}
now := T2.Add(10 * 24 * time.Hour)
@@ -376,5 +376,18 @@ func TestGetRecentUnmetScheduleTimes(t *testing.T) {
t.Errorf("unexpected lack of error")
}
}
{
// Case 7: now is way way ahead of last start time, but there is a short deadline.
sj.ObjectMeta.CreationTimestamp = metav1.Time{Time: T1.Add(-2 * time.Hour)}
sj.Status.LastScheduleTime = &metav1.Time{Time: T1.Add(-1 * time.Hour)}
now := T2.Add(10 * 24 * time.Hour)
// Deadline is short
deadline := int64(2 * 60 * 60)
sj.Spec.StartingDeadlineSeconds = &deadline
_, err := getRecentUnmetScheduleTimes(sj, now)
if err != nil {
t.Errorf("unexpected error")
}
}
}