Add ability to skip stats for performance tests if there is a custom stats name
This commit is contained in:
@@ -59,7 +59,7 @@ class Stats(
|
|||||||
)) {
|
)) {
|
||||||
val n = "$id : ${v.first}"
|
val n = "$id : ${v.first}"
|
||||||
|
|
||||||
TeamCity.test(n, durationMs = v.third) {
|
TeamCity.test(n, durationMs = v.third, includeStats = false) {
|
||||||
TeamCity.statValue("$id${v.second}", v.third)
|
TeamCity.statValue("$id${v.second}", v.third)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ 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 {
|
shortName?.let {
|
||||||
TeamCity.test(it, durationMs = mean) {
|
TeamCity.test(it, durationMs = mean, includeStats = false) {
|
||||||
TeamCity.statValue(it, mean)
|
TeamCity.statValue(it, mean)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,15 +39,15 @@ object TeamCity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun test(name: String, durationMs: Long? = null, errors: List<Throwable>, block: () -> Unit) {
|
fun test(name: String, durationMs: Long? = null, errors: List<Throwable>, block: () -> Unit) {
|
||||||
test(name, durationMs, if (errors.isNotEmpty()) toDetails(errors) else null, block)
|
test(name, durationMs, errorDetails = if (errors.isNotEmpty()) toDetails(errors) else null, block = block)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test(name: String, durationMs: Long? = null, errorDetails: String? = null, block: () -> Unit) {
|
fun test(name: String, durationMs: Long? = null, includeStats: Boolean = true, errorDetails: String? = null, block: () -> Unit) {
|
||||||
testStarted(name)
|
testStarted(name)
|
||||||
try {
|
try {
|
||||||
block()
|
block()
|
||||||
} finally {
|
} finally {
|
||||||
statValue(name, durationMs ?: -1)
|
if (includeStats) statValue(name, durationMs ?: -1)
|
||||||
if (errorDetails != null) {
|
if (errorDetails != null) {
|
||||||
testFailed(name, errorDetails)
|
testFailed(name, errorDetails)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user