Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Krystian Panek committed Mar 3, 2021
1 parent fa1e7f2 commit 3f35960
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class HealthChecker(val common: CommonExtension) {

var all = listOf<HealthStatus>()

val allStatuses get() = all.sortedWith(compareBy({ it.succeed }, { it.check.name })).joinToString("\n")

var passed = listOf<HealthStatus>()

val passedRatio get() = "${passed.size}/${all.size} (${Formats.percent(passed.size, all.size)})"
Expand All @@ -84,12 +86,10 @@ class HealthChecker(val common: CommonExtension) {
assuranceRetry.withSleepTillEnd { no ->
step = "Health checking ($no/${assuranceRetry.times})"
start(retry, verbose)
logger.lifecycle("Health checking passed ($no/${assuranceRetry.times})")
}
} catch (e: HealthException) {
val message = listOf(
"Health checking failed. Success ratio: $passedRatio:",
all.sortedWith(compareBy({ it.succeed }, { it.check.name })).joinToString("\n")
).joinToString("\n")
val message = "Health checking failed. Success ratio: $passedRatio:\n$allStatuses"
when {
verbose -> throw HealthException(message)
else -> logger.error(message)
Expand All @@ -101,9 +101,7 @@ class HealthChecker(val common: CommonExtension) {
common.progressCountdown(waitAfter.get())
}

val message = "Health checking succeed.\n" +
all.sortedWith(compareBy({ it.succeed }, { it.check.name })).joinToString("\n")
logger.lifecycle(message)
logger.lifecycle("Health checking succeed.\n$allStatuses")
}

return all
Expand Down

0 comments on commit 3f35960

Please sign in to comment.