fix(monitor): inject time into ComputeDailyBreakdown for testability
Test failed near midnight when outage events fell in previous day's bucket. Accept a now parameter instead of calling time.Now() internally.
This commit was merged in pull request #91.
This commit is contained in:
@@ -127,8 +127,7 @@ func ComputeSLA(changes []models.StateChange, currentStatus string, window time.
|
||||
return report
|
||||
}
|
||||
|
||||
func ComputeDailyBreakdown(changes []models.StateChange, currentStatus string, days int) []DayReport {
|
||||
now := time.Now()
|
||||
func ComputeDailyBreakdown(changes []models.StateChange, currentStatus string, days int, now time.Time) []DayReport {
|
||||
reports := make([]DayReport, days)
|
||||
|
||||
for i := 0; i < days; i++ {
|
||||
|
||||
Reference in New Issue
Block a user