Tweaked performance-tests stats output

This commit is contained in:
Vladimir Dolzhenko
2020-06-07 23:02:38 +02:00
parent 8216e5cd72
commit 19855c5bd5
2 changed files with 12 additions and 12 deletions
@@ -77,10 +77,8 @@ class Stats(
val shortName = if (perfCounterName.endsWith(": time")) n.removeSuffix(": time") else null val shortName = if (perfCounterName.endsWith(": time")) n.removeSuffix(": time") else null
shortName?.let { TeamCity.test(shortName, durationMs = mean) {
TeamCity.test(it, durationMs = mean, includeStats = false) { TeamCity.statValue(n, mean)
TeamCity.statValue(it, mean)
}
} }
} }
@@ -172,7 +170,7 @@ class Stats(
"$testName stability is $stabilityPercentage %, above accepted level of $acceptanceStabilityLevel %" "$testName stability is $stabilityPercentage %, above accepted level of $acceptanceStabilityLevel %"
} }
TeamCity.test(stabilityName, errorDetails = error) { TeamCity.test(stabilityName, errorDetails = error, includeStats = false) {
TeamCity.statValue(stabilityName, stabilityPercentage) TeamCity.statValue(stabilityName, stabilityPercentage)
} }
} }
@@ -42,16 +42,18 @@ object TeamCity {
test(name, durationMs, errorDetails = if (errors.isNotEmpty()) toDetails(errors) else null, block = block) test(name, durationMs, errorDetails = if (errors.isNotEmpty()) toDetails(errors) else null, block = block)
} }
fun test(name: String, durationMs: Long? = null, includeStats: Boolean = true, errorDetails: String? = null, block: () -> Unit) { fun test(name: String?, durationMs: Long? = null, includeStats: Boolean = true, errorDetails: String? = null, block: () -> Unit) {
testStarted(name) name?.let { testStarted(it) }
try { try {
block() block()
} finally { } finally {
if (includeStats) statValue(name, durationMs ?: -1) name?.let {
if (errorDetails != null) { if (includeStats) statValue(it, durationMs ?: -1)
testFailed(name, errorDetails) if (errorDetails != null) {
} else { testFailed(it, errorDetails)
testFinished(name, durationMs) } else {
testFinished(it, durationMs)
}
} }
} }
} }