From 32ca458dee8b7ecc5839c0f3570fbec45b5232a9 Mon Sep 17 00:00:00 2001 From: Sinan Kozak Date: Wed, 5 Aug 2020 08:54:21 +0300 Subject: [PATCH 1/2] Process junit xml even when full junit is not enabled --- contributing.md | 2 +- .../ftl/config/common/CommonFlankConfig.kt | 3 +- .../kotlin/ftl/reports/util/ReportManager.kt | 1 + .../test/kotlin/ftl/fixtures/flank.ios.yml | 1 + .../test/kotlin/ftl/fixtures/flank.local.yml | 1 + .../ftl/reports/utils/ReportManagerTest.kt | 29 +++++++++++++++++-- 6 files changed, 33 insertions(+), 4 deletions(-) diff --git a/contributing.md b/contributing.md index a4d1bbfb9e..72d414ec8f 100644 --- a/contributing.md +++ b/contributing.md @@ -33,7 +33,7 @@ Run `./gradlew check` to fix lint issues ## Adding new gcloud property common to iOS and Android -- Add property to `GcloudYml` and update `keys` +- Add property to `GcloudYml` and update `keys` in config files - Update `IArgs` with new property - Update `AndroidArgs` to reference the propery and update `toString` - Update `IosArgs` to reference the propery and `toString` diff --git a/test_runner/src/main/kotlin/ftl/config/common/CommonFlankConfig.kt b/test_runner/src/main/kotlin/ftl/config/common/CommonFlankConfig.kt index fb8fd0f4ce..1802693fda 100644 --- a/test_runner/src/main/kotlin/ftl/config/common/CommonFlankConfig.kt +++ b/test_runner/src/main/kotlin/ftl/config/common/CommonFlankConfig.kt @@ -161,7 +161,8 @@ data class CommonFlankConfig @JsonIgnore constructor( "ignore-failed-tests", "keep-file-path", "output-style", - "disable-results-upload" + "disable-results-upload", + "full-junit-result" ) const val defaultLocalResultsDir = "results" 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 24260f62ce..d5e2433cc7 100644 --- a/test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt +++ b/test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt @@ -115,6 +115,7 @@ object ReportManager { when { args.fullJUnitResult -> processFullJunitResult(args, matrices, testShardChunks) args.useLegacyJUnitResult -> processJunitXml(testSuite, args, testShardChunks) + else -> processJunitXml(testSuite, args, testShardChunks) } matrices.validateMatrices(args.ignoreFailedTests) } diff --git a/test_runner/src/test/kotlin/ftl/fixtures/flank.ios.yml b/test_runner/src/test/kotlin/ftl/fixtures/flank.ios.yml index ed490231b1..7e93eb3a04 100644 --- a/test_runner/src/test/kotlin/ftl/fixtures/flank.ios.yml +++ b/test_runner/src/test/kotlin/ftl/fixtures/flank.ios.yml @@ -18,3 +18,4 @@ flank: num-test-runs: 1 run-timeout: 60m output-style: single + full-junit-result: false diff --git a/test_runner/src/test/kotlin/ftl/fixtures/flank.local.yml b/test_runner/src/test/kotlin/ftl/fixtures/flank.local.yml index 8112d59d8a..ef2cba5692 100644 --- a/test_runner/src/test/kotlin/ftl/fixtures/flank.local.yml +++ b/test_runner/src/test/kotlin/ftl/fixtures/flank.local.yml @@ -30,3 +30,4 @@ flank: num-test-runs: 1 run-timeout: 60m output-style: single + full-junit-result: false 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 97d6983a9e..7e097135dd 100644 --- a/test_runner/src/test/kotlin/ftl/reports/utils/ReportManagerTest.kt +++ b/test_runner/src/test/kotlin/ftl/reports/utils/ReportManagerTest.kt @@ -88,6 +88,31 @@ class ReportManagerTest { verify { GcStorage.uploadJunitXml(junitTestResult!!, mockArgs) } } + @Test + fun `uploadJunitXml should be called when legacy junit disabled`() { + val matrix = matrixPathToObj("./src/test/kotlin/ftl/fixtures/success_result", AndroidArgs.default()) + val mockArgs = prepareMockAndroidArgs() + every { mockArgs.useLegacyJUnitResult } returns false + every { mockArgs.project } returns "projecId" + + val junitTestResult = ReportManager.processXmlFromFile(matrix, mockArgs, ::parseOneSuiteXml) + ReportManager.generate(matrix, mockArgs, emptyList()) + verify { GcStorage.uploadJunitXml(junitTestResult!!, mockArgs) } + } + + @Test + fun `uploadJunitXml should be called when full junit enabled`() { + val matrix = matrixPathToObj("./src/test/kotlin/ftl/fixtures/success_result", AndroidArgs.default()) + val mockArgs = prepareMockAndroidArgs() + every { mockArgs.useLegacyJUnitResult } returns false + every { mockArgs.fullJUnitResult } returns true + every { mockArgs.project } returns "projecId" + + val junitTestResult = ReportManager.processXmlFromFile(matrix, mockArgs, ::parseOneSuiteXml) + ReportManager.generate(matrix, mockArgs, emptyList()) + verify { GcStorage.uploadJunitXml(junitTestResult!!, mockArgs) } + } + @Test fun `uploadResults should be called`() { val matrix = matrixPathToObj("./src/test/kotlin/ftl/fixtures/success_result", AndroidArgs.default()) @@ -106,7 +131,7 @@ class ReportManagerTest { } @Test - fun `uploadResults should't be called when disable-results-upload set`() { + fun `uploadResults shouldn't be called when disable-results-upload set`() { val matrix = matrixPathToObj("./src/test/kotlin/ftl/fixtures/success_result", AndroidArgs.default()) val mockArgs = prepareMockAndroidArgs() every { mockArgs.disableResultsUpload } returns true @@ -125,7 +150,7 @@ class ReportManagerTest { } @Test - fun `uploadResults with FullJUnit should't be called`() { + fun `uploadResults without FullJUnit shouldn't be called`() { val matrix = matrixPathToObj("./src/test/kotlin/ftl/fixtures/success_result", AndroidArgs.default()) val mockArgs = prepareMockAndroidArgs() mockkObject(GcStorage) { From 53cc854372335bbe0838377a7a2973ea40f940fa Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Sat, 8 Aug 2020 19:45:51 -0400 Subject: [PATCH 2/2] Update release notes --- release_notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_notes.md b/release_notes.md index 032c21ae4f..20f22d1c21 100644 --- a/release_notes.md +++ b/release_notes.md @@ -3,7 +3,7 @@ - [#950](https://github.com/Flank/flank/pull/950) Fix crash when --legacy-junit-result set. ([adamfilipow92](https://github.com/adamfilipow92)) - [#948](https://github.com/Flank/flank/pull/948) Increment retry tries and change sync tag for jfrogSync. ([piotradamczyk5](https://github.com/piotradamczyk5)) - [#946](https://github.com/Flank/flank/pull/946) Added tests for flank scripts. ([piotradamczyk5](https://github.com/piotradamczyk5)) -- +- [#935](https://github.com/Flank/flank/pull/935) Process junit xml even when full junit is not enabled. ([kozaxinan](https://github.com/kozaxinan)) - -