INNER CODE UNIT · Go
killtimes
asobti/kube-monkey · internal/pkg/calendar/calendar_test.go:76
killtimes := killTimesInRange(now, testRand(), 10*time.Minute, 10, 16, loc)
assert.NotEmpty(t, killtimes)
for i, killtime := range killtimes {
assert.False(t, killtime.Before(rangeStart))
assert.True(t, killtime.Before(rangeEnd))
if i > 0 {
assert.False(t, killtime.Before(killtimes[i-1]), "kill times should be in order")
}
}
}
func TestKillTimesInRangeSharesWhatIsLeftOfTheRange(t *testing.T) {
loc := time.UTC
// Half way through a 6 hour range, so only half of the kills are still due
now := time.Date(2024, 3, 12, 13, 0, 0, 0, loc)
killtimes := killTimesInRange(now, testRand(), time.Hour, 10, 16, loc)