Skip to content

Commit

Permalink
Refactor how we report failure details on CI for failed and ignored t…
Browse files Browse the repository at this point in the history
…ests

GitOrigin-RevId: 0c5b07d8a7ed0cbbb23e960672e402b4f7cd2359
  • Loading branch information
annaMarchenkoJetBrains authored and intellij-monorepo-bot committed Feb 13, 2025
1 parent c1cfc2f commit 69f36d0
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,26 @@ object FailureDetailsForTeamcity : FailureDetailsOnCI {
override fun getFailureDetails(runContext: IDERunContext): String {

return if (CIServer.instance.isBuildRunningOnCI)
getFailureDetailsForCI(runContext)
getFailureDetailsWithBisectLinkForCI(runContext)
else getFailureDetailsForLocalRun(runContext)
}

fun getFailureDetailsForIgnoredTest(runContext: IDERunContext): String {
return getFailureDetailsForCI(runContext)
}

private fun getFailureDetailsWithBisectLinkForCI(runContext: IDERunContext): String {
val buildId = (CIServer.instance as? TeamCityCIServer)?.buildId.takeIf { it != TeamCityCIServer.LOCAL_RUN_ID }
return getFailureDetailsForCI(runContext) +
(buildId?.let { System.lineSeparator() + "Link to bisect: https://ij-perf.labs.jb.gg/bisect/launcher?buildId=$it" } ?: "")
}

private fun getFailureDetailsForCI(runContext: IDERunContext): String {
val testMethodName = getTestMethodName().ifEmpty { runContext.contextName }
val uri = getLinkToCIArtifacts(runContext)
val buildId = (CIServer.instance as? TeamCityCIServer)?.buildId.takeIf { it != TeamCityCIServer.LOCAL_RUN_ID }
return "Test: $testMethodName" + System.lineSeparator() +
"You can find logs and other info in CI artifacts under the path ${runContext.contextName}" + System.lineSeparator() +
"Link on TC artifacts $uri" +
(buildId?.let { System.lineSeparator() + "Link to bisect: https://ij-perf.labs.jb.gg/bisect/launcher?buildId=$it" } ?: "")
"Link on TC artifacts $uri"
}

override fun getLinkToCIArtifacts(runContext: IDERunContext): String {
Expand Down

0 comments on commit 69f36d0

Please sign in to comment.