INNER CODE UNIT · Go

TestKillTimesInRangeSharesWhatIsLeftOfTheRange

asobti/kube-monkey · internal/pkg/calendar/calendar_test.go:88

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)

	assert.Len(t, killtimes, 12)
	for _, killtime := range killtimes {
		assert.False(t, killtime.Before(now))
	}
}

func TestKillTimesInRangeNothingLeftToSchedule(t *testing.T) {
	loc := time.UTC

	// The range has already passed
	now := time.Date(2024, 3, 12, 20, 0, 0, 0, loc)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…