From 14b1ed3680012a1108ab47bd7e59e8206c69bebe Mon Sep 17 00:00:00 2001 From: adamfilipow92 <64852261+adamfilipow92@users.noreply.github.com> Date: Wed, 9 Sep 2020 14:45:30 +0200 Subject: [PATCH] feat: print the matrices web link at the end of a run (#1097) * added printing option for matrices web link on end of output * detekt * matrices.validate() moved outside report generation * detekt * Update ReportManagerTest.kt --- .../src/main/kotlin/ftl/reports/util/ReportManager.kt | 2 -- test_runner/src/main/kotlin/ftl/run/NewTestRun.kt | 7 +++++++ test_runner/src/main/kotlin/ftl/run/RefreshLastRun.kt | 3 +++ .../main/kotlin/ftl/run/platform/common/AfterRunTests.kt | 2 +- .../src/test/kotlin/ftl/reports/utils/ReportManagerTest.kt | 2 ++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt b/test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt index 47b8e0c006..df250302ae 100644 --- a/test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt +++ b/test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt @@ -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 @@ -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 { diff --git a/test_runner/src/main/kotlin/ftl/run/NewTestRun.kt b/test_runner/src/main/kotlin/ftl/run/NewTestRun.kt index 5064a55889..01345d1552 100644 --- a/test_runner/src/main/kotlin/ftl/run/NewTestRun.kt +++ b/test_runner/src/main/kotlin/ftl/run/NewTestRun.kt @@ -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 @@ -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) } } diff --git a/test_runner/src/main/kotlin/ftl/run/RefreshLastRun.kt b/test_runner/src/main/kotlin/ftl/run/RefreshLastRun.kt index 3802406a36..8fa79f55ff 100644 --- a/test_runner/src/main/kotlin/ftl/run/RefreshLastRun.kt +++ b/test_runner/src/main/kotlin/ftl/run/RefreshLastRun.kt @@ -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 @@ -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 **/ diff --git a/test_runner/src/main/kotlin/ftl/run/platform/common/AfterRunTests.kt b/test_runner/src/main/kotlin/ftl/run/platform/common/AfterRunTests.kt index 3ca2d05510..92d41fae03 100644 --- a/test_runner/src/main/kotlin/ftl/run/platform/common/AfterRunTests.kt +++ b/test_runner/src/main/kotlin/ftl/run/platform/common/AfterRunTests.kt @@ -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) { diff --git a/test_runner/src/test/kotlin/ftl/reports/utils/ReportManagerTest.kt b/test_runner/src/test/kotlin/ftl/reports/utils/ReportManagerTest.kt index 99598c8440..c2f4540e2b 100644 --- a/test_runner/src/test/kotlin/ftl/reports/utils/ReportManagerTest.kt +++ b/test_runner/src/test/kotlin/ftl/reports/utils/ReportManagerTest.kt @@ -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 @@ -52,6 +53,7 @@ class ReportManagerTest { every { mockArgs.smartFlankGcsPath } returns "" every { mockArgs.useLegacyJUnitResult } returns true ReportManager.generate(matrix, mockArgs, emptyList()) + matrix.validate() } @Test