in app/com/gu/contentapi/sanity/support/TestFailureHandlingSupport.scala [125:141]
override def handleTestFailure(testName: String, exception: Throwable, tags: Set[String]): Unit = {
Console.err.println(Console.RED + "Test failure: " + exception.getMessage + Console.RESET)
// increment the incident count only if there is an existing recent incident or it is the first incident {
if (lastIncidentDateTime.isEmpty || (Duration.between(lastIncidentDateTime.get, ZonedDateTime.now()).toMinutes < RecentIncidentWindowMinutes)) {
//increment counter
incrementIncidentCount()
if (incidentCount == PagerDutyThreshold) {
//report when threshold is met
sendPagerDutyAlert(testName, exception, tags, latestIncidentKey())
resetToZero()
}
}
else {
//reset counter if incident is not recent
resetToOne()
}
}