Skip to content

Commit

Permalink
feat: print the matrices web link at the end of a run (#1097)
Browse files Browse the repository at this point in the history
* added printing option for matrices web link on end of output

* detekt

* matrices.validate() moved outside report generation

* detekt

* Update ReportManagerTest.kt
  • Loading branch information
adamfilipow92 authored Sep 9, 2020
1 parent a36407c commit 14b1ed3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 0 additions & 2 deletions test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import ftl.args.ShardChunks
import ftl.gc.GcStorage
import ftl.json.MatrixMap
import ftl.json.isAllSuccessful
import ftl.json.validate
import ftl.reports.CostReport
import ftl.reports.FullJUnitReport
import ftl.reports.HtmlErrorReport
Expand Down Expand Up @@ -117,7 +116,6 @@ object ReportManager {
args.useLegacyJUnitResult -> processJunitXml(testSuite, args, testShardChunks)
else -> processJunitXml(testSuite, args, testShardChunks)
}
matrices.validate(args.ignoreFailedTests)
}

private fun IgnoredTestCases.toJunitTestsResults() = getSkippedJUnitTestSuite(map {
Expand Down
7 changes: 7 additions & 0 deletions test_runner/src/main/kotlin/ftl/run/NewTestRun.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import ftl.args.IArgs
import ftl.args.IosArgs
import ftl.json.SavedMatrix
import ftl.json.updateMatrixMap
import ftl.json.validate
import ftl.reports.util.ReportManager
import ftl.run.common.fetchArtifacts
import ftl.run.common.pollMatrices
import ftl.run.exception.FlankGeneralError
import ftl.run.exception.FlankTimeoutError
import ftl.run.model.TestResult
import ftl.run.platform.common.printMatricesWebLinks
import ftl.run.platform.runAndroidTests
import ftl.run.platform.runIosTests
import kotlinx.coroutines.TimeoutCancellationException
Expand All @@ -25,6 +27,11 @@ suspend fun newTestRun(args: IArgs) = withTimeoutOrNull(args.parsedTimeout) {
cancelTestsOnTimeout(args.project, matrixMap.map) { fetchArtifacts(matrixMap, args) }

ReportManager.generate(matrixMap, args, testShardChunks, ignoredTests)

println()
matrixMap.printMatricesWebLinks(args.project)

matrixMap.validate(args.ignoreFailedTests)
}
}

Expand Down
3 changes: 3 additions & 0 deletions test_runner/src/main/kotlin/ftl/run/RefreshLastRun.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import ftl.run.common.updateMatrixFile
import ftl.args.ShardChunks
import ftl.json.needsUpdate
import ftl.json.updateWithMatrix
import ftl.json.validate
import ftl.util.MatrixState
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
Expand All @@ -33,6 +34,8 @@ suspend fun refreshLastRun(currentArgs: IArgs, testShardChunks: ShardChunks) {

// Must generate reports *after* fetching xml artifacts since reports require xml
ReportManager.generate(matrixMap, lastArgs, testShardChunks)

matrixMap.validate(lastArgs.ignoreFailedTests)
}

/** Refresh all in progress matrices in parallel **/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private fun saveConfigFile(matrixMap: MatrixMap, args: IArgs) {
Files.write(configFilePath, args.data.toByteArray())
}

private suspend inline fun MatrixMap.printMatricesWebLinks(project: String) = coroutineScope {
internal suspend inline fun MatrixMap.printMatricesWebLinks(project: String) = coroutineScope {
println("Matrices webLink")
map.values.map {
launch(Dispatchers.IO) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ftl.reports.utils
import com.google.common.truth.Truth.assertThat
import ftl.args.AndroidArgs
import ftl.gc.GcStorage
import ftl.json.validate
import ftl.reports.CostReport
import ftl.reports.FullJUnitReport
import ftl.reports.JUnitReport
Expand Down Expand Up @@ -52,6 +53,7 @@ class ReportManagerTest {
every { mockArgs.smartFlankGcsPath } returns ""
every { mockArgs.useLegacyJUnitResult } returns true
ReportManager.generate(matrix, mockArgs, emptyList())
matrix.validate()
}

@Test
Expand Down

0 comments on commit 14b1ed3

Please sign in to comment.