INNER CODE UNIT · Go

TestKillTimesInRangeNothingLeftToSchedule

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

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

	// The range has already passed
	now := time.Date(2024, 3, 12, 20, 0, 0, 0, loc)
	assert.Empty(t, killTimesInRange(now, testRand(), time.Hour, 10, 16, loc))

	// The range is not a range at all
	now = time.Date(2024, 3, 12, 8, 0, 0, 0, loc)
	assert.Empty(t, killTimesInRange(now, testRand(), time.Hour, 16, 16, loc))
	assert.Empty(t, killTimesInRange(now, testRand(), time.Hour, 16, 10, loc))

	// No mtbf to go by
	assert.Empty(t, killTimesInRange(now, testRand(), 0, 10, 16, loc))
}

// An mtbf longer than a day means a kill on some days only. The odds of a kill
// on any single day are 24h/mtbf, which is how the mtbf label behaved when days

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…