INNER CODE UNIT · Go

TestKillTimesInRangeCount

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

func TestKillTimesInRangeCount(t *testing.T) {
	loc := time.UTC
	// Before the range opens, so the whole 6 hour range is still available
	now := time.Date(2024, 3, 12, 8, 0, 0, 0, loc)

	// A victim dies 24h/mtbf times a day, whatever the length of the range
	for mtbf, expected := range map[time.Duration]int{
		24 * time.Hour:   1,
		12 * time.Hour:   2,
		2 * time.Hour:    12,
		30 * time.Minute: 48,
	} {
		killtimes := killTimesInRange(now, testRand(), mtbf, 10, 16, loc)

		assert.Len(t, killtimes, expected, mtbf.String())
	}
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…