INNER CODE UNIT · Go
TestKillTimesInRangeAreInsideTheRange
asobti/kube-monkey · internal/pkg/calendar/calendar_test.go:70
func TestKillTimesInRangeAreInsideTheRange(t *testing.T) {
loc := time.UTC
now := time.Date(2024, 3, 12, 8, 0, 0, 0, loc)
rangeStart := time.Date(2024, 3, 12, 10, 0, 0, 0, loc)
rangeEnd := time.Date(2024, 3, 12, 16, 0, 0, 0, loc)
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")
}
}
}