From 208425c1382c2028039d1775024847d5253526b6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2020 14:35:17 +0000 Subject: [PATCH 1/2] build: Dependencies updates [2020-11-02] (#1288) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Automatic PR] Dependencies update * Fix MultiLinePrinterTest * Fix unit test * Fix output logic Co-authored-by: pawelpasterz Co-authored-by: Janek Góral Co-authored-by: Pawel Pasterz --- buildSrc/src/main/kotlin/Versions.kt | 8 ++++---- .../src/main/kotlin/ftl/args/CreateCommonArgs.kt | 2 +- .../src/test/kotlin/ftl/args/AndroidArgsTest.kt | 10 +++++----- test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt | 8 ++++---- .../test/kotlin/ftl/run/status/MultiLinePrinterTest.kt | 2 ++ 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index b2dae80325..54625256ae 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -21,7 +21,7 @@ object Versions { const val KOTLIN = "1.4.10" // https://github.com/Kotlin/kotlinx.coroutines/releases - const val KOTLIN_COROUTINES = "1.3.9" + const val KOTLIN_COROUTINES = "1.4.0" // https://github.com/remkop/picocli/releases const val PICOCLI = "4.5.2" @@ -38,7 +38,7 @@ object Versions { const val GOOGLE_NIO = "0.121.2" // https://search.maven.org/search?q=a:google-cloud-storage%20g:com.google.cloud - const val GOOGLE_STORAGE = "1.113.1" + const val GOOGLE_STORAGE = "1.113.2" // https://github.com/google/gson/releases const val GSON = "2.8.6" @@ -79,7 +79,7 @@ object Versions { const val COMMON_TEXT = "1.9" // https://github.com/fusesource/jansi/releases - const val JANSI = "1.18" + const val JANSI = "2.0.1" // https://github.com/ben-manes/gradle-versions-plugin/releases const val BEN_MANES = "0.33.0" @@ -88,9 +88,9 @@ object Versions { const val PROGUARD = "7.0.0" // ============== flank-scripts ============== + const val KOTLIN_SERIALIZATION = "1.0.1" const val ARCHIVE_LIB = "1.1.0" const val TUKAANI_XZ = "1.0" - const val KOTLIN_SERIALIZATION = "1.0.0" const val FUEL = "2.3.0" const val CLIKT = "2.8.0" const val JCABI_GITHUB = "1.1.2" diff --git a/test_runner/src/main/kotlin/ftl/args/CreateCommonArgs.kt b/test_runner/src/main/kotlin/ftl/args/CreateCommonArgs.kt index 2393846831..5901926305 100644 --- a/test_runner/src/main/kotlin/ftl/args/CreateCommonArgs.kt +++ b/test_runner/src/main/kotlin/ftl/args/CreateCommonArgs.kt @@ -66,4 +66,4 @@ private val CommonConfig.defaultOutputStyle private val CommonConfig.hasMultipleExecutions get() = gcloud.flakyTestAttempts!! > 0 || - (!flank.disableSharding!! && flank.maxTestShards!! > 0) + (!flank.disableSharding!! && flank.maxTestShards!! > 1) diff --git a/test_runner/src/test/kotlin/ftl/args/AndroidArgsTest.kt b/test_runner/src/test/kotlin/ftl/args/AndroidArgsTest.kt index fc26a3e798..4d45211b14 100644 --- a/test_runner/src/test/kotlin/ftl/args/AndroidArgsTest.kt +++ b/test_runner/src/test/kotlin/ftl/args/AndroidArgsTest.kt @@ -440,7 +440,7 @@ AndroidArgs run-timeout: -1 legacy-junit-result: true ignore-failed-tests: false - output-style: multi + output-style: verbose disable-results-upload: false default-class-test-time: 240.0 """.trimIndent(), @@ -488,7 +488,7 @@ AndroidArgs assert(testTargetsAlwaysRun, empty) assert(disableSharding, false) assert(runTimeout, "-1") - assert(outputStyle, OutputStyle.Multi) + assert(outputStyle, OutputStyle.Verbose) assert(fullJUnitResult, false) } } @@ -1199,17 +1199,17 @@ AndroidArgs @Test fun `cli output-style`() { val cli = AndroidRunCommand() - CommandLine(cli).parseArgs("--output-style=verbose") + CommandLine(cli).parseArgs("--output-style=multi") val yaml = """ gcloud: app: $appApk test: $testApk """ - assertThat(AndroidArgs.load(yaml).validate().outputStyle).isEqualTo(OutputStyle.Multi) + assertThat(AndroidArgs.load(yaml).validate().outputStyle).isEqualTo(OutputStyle.Verbose) val args = AndroidArgs.load(yaml, cli).validate() - assertThat(args.outputStyle).isEqualTo(OutputStyle.Verbose) + assertThat(args.outputStyle).isEqualTo(OutputStyle.Multi) } @Test(expected = FlankConfigurationError::class) diff --git a/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt b/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt index 641b97aa81..5735747aed 100644 --- a/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt +++ b/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt @@ -326,7 +326,7 @@ IosArgs local-result-dir: results run-timeout: -1 ignore-failed-tests: false - output-style: multi + output-style: verbose disable-results-upload: false default-class-test-time: 240.0 """.trimIndent(), @@ -858,17 +858,17 @@ IosArgs @Test fun `cli output-style`() { val cli = IosRunCommand() - CommandLine(cli).parseArgs("--output-style=verbose") + CommandLine(cli).parseArgs("--output-style=multi") val yaml = """ gcloud: test: $testPath xctestrun-file: $testPath """ - assertThat(IosArgs.load(yaml).outputStyle).isEqualTo(OutputStyle.Multi) + assertThat(IosArgs.load(yaml).outputStyle).isEqualTo(OutputStyle.Verbose) val args = IosArgs.load(yaml, cli) - assertThat(args.outputStyle).isEqualTo(OutputStyle.Verbose) + assertThat(args.outputStyle).isEqualTo(OutputStyle.Multi) } private fun getValidTestsSample() = listOf( diff --git a/test_runner/src/test/kotlin/ftl/run/status/MultiLinePrinterTest.kt b/test_runner/src/test/kotlin/ftl/run/status/MultiLinePrinterTest.kt index 3a8e1c4e98..a94dd4b01b 100644 --- a/test_runner/src/test/kotlin/ftl/run/status/MultiLinePrinterTest.kt +++ b/test_runner/src/test/kotlin/ftl/run/status/MultiLinePrinterTest.kt @@ -6,6 +6,7 @@ import io.mockk.every import io.mockk.spyk import io.mockk.verify import org.fusesource.jansi.Ansi +import org.fusesource.jansi.AnsiConsole import org.junit.Assert.assertEquals import org.junit.Rule import org.junit.Test @@ -21,6 +22,7 @@ class MultiLinePrinterTest { // given val ansi = spyk(Ansi.ansi()) { every { this@spyk.toString() } returns "" } val printChanges = MultiLinePrinter { ansi } + AnsiConsole.systemUninstall() // when printChanges(changes1) From 1c68cc9a81f5961ae75314aadbbb6097a4a074d9 Mon Sep 17 00:00:00 2001 From: piotradamczyk5 <65554637+piotradamczyk5@users.noreply.github.com> Date: Tue, 3 Nov 2020 09:42:36 +0100 Subject: [PATCH 2/2] feat: Add --test-special-entitlements for iOS (#1291) --- docs/index.md | 5 +++++ test_runner/flank.ios.yml | 7 ++++++- .../src/main/kotlin/ftl/args/CreateIosArgs.kt | 3 ++- test_runner/src/main/kotlin/ftl/args/IosArgs.kt | 4 +++- .../main/kotlin/ftl/config/ios/IosGcloudConfig.kt | 12 ++++++++++++ .../src/main/kotlin/ftl/gc/GcIosTestMatrix.kt | 1 + test_runner/src/test/kotlin/Debug.kt | 7 +++++-- test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt | 3 +++ .../ftl/cli/firebase/test/ios/IosRunCommandTest.kt | 8 ++++++++ 9 files changed, 45 insertions(+), 5 deletions(-) diff --git a/docs/index.md b/docs/index.md index 2fef138aba..307676a30e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -176,6 +176,11 @@ gcloud: ## The type of iOS test to run. TYPE must be one of: xctest, game-loop. Default: xctest # type: xctest + ## Enables testing special app entitlements. Re-signs an app having special entitlements with a new application-identifier. + ## This currently supports testing Push Notifications (aps-environment) entitlement for up to one app in a project. + ## Note: Because this changes the app's identifier, make sure none of the resources in your zip file contain direct references to the test app's bundle id. + # test-special-entitlements: false + flank: # -- FlankYml -- diff --git a/test_runner/flank.ios.yml b/test_runner/flank.ios.yml index 9b760a40bc..7dacd5d183 100644 --- a/test_runner/flank.ios.yml +++ b/test_runner/flank.ios.yml @@ -107,6 +107,11 @@ gcloud: ## The type of iOS test to run. TYPE must be one of: xctest, game-loop. Default: xctest # type: xctest + ## Enables testing special app entitlements. Re-signs an app having special entitlements with a new application-identifier. + ## This currently supports testing Push Notifications (aps-environment) entitlement for up to one app in a project. + ## Note: Because this changes the app's identifier, make sure none of the resources in your zip file contain direct references to the test app's bundle id. + # test-special-entitlements: false + flank: # -- FlankYml -- @@ -144,7 +149,7 @@ flank: ## Default: 240.0 # default-class-test-time: 30 -## Disables sharding. Useful for parameterized tests. + ## Disables sharding. Useful for parameterized tests. # disable-sharding: false ## always run - these tests are inserted at the beginning of every shard diff --git a/test_runner/src/main/kotlin/ftl/args/CreateIosArgs.kt b/test_runner/src/main/kotlin/ftl/args/CreateIosArgs.kt index 6a5b1aac14..e4543145b0 100644 --- a/test_runner/src/main/kotlin/ftl/args/CreateIosArgs.kt +++ b/test_runner/src/main/kotlin/ftl/args/CreateIosArgs.kt @@ -30,7 +30,8 @@ private fun createIosArgs( xcodeVersion = gcloud.xcodeVersion, additionalIpas = gcloud.additionalIpas!!.map { it.normalizeFilePath() }, testTargets = flank.testTargets?.filterNotNull().orEmpty(), - obfuscateDumpShards = obfuscate + obfuscateDumpShards = obfuscate, + testSpecialEntitlements = gcloud.testSpecialEntitlements ?: false ) private fun convertToShardCount(inputValue: Int) = diff --git a/test_runner/src/main/kotlin/ftl/args/IosArgs.kt b/test_runner/src/main/kotlin/ftl/args/IosArgs.kt index afc09e2bce..326a061902 100644 --- a/test_runner/src/main/kotlin/ftl/args/IosArgs.kt +++ b/test_runner/src/main/kotlin/ftl/args/IosArgs.kt @@ -14,7 +14,8 @@ data class IosArgs( val xcodeVersion: String?, val testTargets: List, val obfuscateDumpShards: Boolean, - val additionalIpas: List + val additionalIpas: List, + val testSpecialEntitlements: Boolean? ) : IArgs by commonArgs { override val useLegacyJUnitResult = true @@ -45,6 +46,7 @@ IosArgs additional-ipas: ${ArgsToString.listToString(additionalIpas)} scenario-numbers: ${ArgsToString.listToString(scenarioNumbers)} type: ${type?.ymlName} + test-special-entitlements: $testSpecialEntitlements flank: max-test-shards: $maxTestShards diff --git a/test_runner/src/main/kotlin/ftl/config/ios/IosGcloudConfig.kt b/test_runner/src/main/kotlin/ftl/config/ios/IosGcloudConfig.kt index 9b8cf1e7bd..9e094033bb 100644 --- a/test_runner/src/main/kotlin/ftl/config/ios/IosGcloudConfig.kt +++ b/test_runner/src/main/kotlin/ftl/config/ios/IosGcloudConfig.kt @@ -58,6 +58,17 @@ data class IosGcloudConfig @JsonIgnore constructor( @set:JsonProperty("additional-ipas") var additionalIpas: List? by data + @set:CommandLine.Option( + names = ["--test-special-entitlements"], + description = ["Enables testing special app entitlements. Re-signs an app having special entitlements with a new" + + " application-identifier. This currently supports testing Push Notifications (aps-environment) entitlement " + + "for up to one app in a project.\n" + + "Note: Because this changes the app's identifier, make sure none of the resources in your zip file contain " + + "direct references to the test app's bundle id."] + ) + @set:JsonProperty("test-special-entitlements") + var testSpecialEntitlements: Boolean? by data + constructor() : this(mutableMapOf().withDefault { null }) companion object : IYmlKeys { @@ -73,6 +84,7 @@ data class IosGcloudConfig @JsonIgnore constructor( xctestrunFile = null xcodeVersion = null additionalIpas = emptyList() + testSpecialEntitlements = false } } } diff --git a/test_runner/src/main/kotlin/ftl/gc/GcIosTestMatrix.kt b/test_runner/src/main/kotlin/ftl/gc/GcIosTestMatrix.kt index c2a571aa2e..5bafc39e60 100644 --- a/test_runner/src/main/kotlin/ftl/gc/GcIosTestMatrix.kt +++ b/test_runner/src/main/kotlin/ftl/gc/GcIosTestMatrix.kt @@ -65,6 +65,7 @@ object GcIosTestMatrix { .setTestsZip(FileReference().setGcsPath(testZipGcsPath)) .setXctestrun(FileReference().setGcsPath(xctestrunFileGcsPath)) .setXcodeVersion(args.xcodeVersion) + .setTestSpecialEntitlements(args.testSpecialEntitlements) val iOSTestSetup = IosTestSetup() .setNetworkProfile(args.networkProfile) diff --git a/test_runner/src/test/kotlin/Debug.kt b/test_runner/src/test/kotlin/Debug.kt index 75785a5f1a..3e8efcb9c4 100644 --- a/test_runner/src/test/kotlin/Debug.kt +++ b/test_runner/src/test/kotlin/Debug.kt @@ -12,10 +12,12 @@ fun main() { // run "gradle check" to generate required fixtures val projectId = System.getenv("GOOGLE_CLOUD_PROJECT") ?: "YOUR PROJECT ID" +/* val quantity = "multiple" val type = "gameloop" val extra = "obb" +*/ // Bugsnag keeps the process alive so we must call exitProcess // https://github.com/bugsnag/bugsnag-java/issues/151 @@ -24,14 +26,15 @@ fun main() { // "--debug", "firebase", "test", - "android", + "ios", "run", // "--dry", // "--dump-shards", "--output-style=single", // "--full-junit-result", // "--legacy-junit-result", - "-c=test_runner/src/test/kotlin/ftl/fixtures/test_app_cases/flank-$quantity-$type-$extra.yml", + "-c=/Users/piotr/Projekty/gogo/flank/test_runner/src/test/kotlin/ftl/fixtures/simple-ios-flank.yml", +// "-c=test_runner/src/test/kotlin/ftl/fixtures/test_app_cases/flank-$quantity-$type-$extra.yml", "--project=$projectId" // "--client-details=key1=value1,key2=value2" ) diff --git a/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt b/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt index 5735747aed..8740eada1a 100644 --- a/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt +++ b/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt @@ -78,6 +78,7 @@ class IosArgsTest { orientation: default num-flaky-test-attempts: 4 type: xctest + test-special-entitlements: true flank: max-test-shards: 7 @@ -244,6 +245,7 @@ IosArgs - $testIpa2 scenario-numbers: type: xctest + test-special-entitlements: true flank: max-test-shards: 7 @@ -306,6 +308,7 @@ IosArgs additional-ipas: scenario-numbers: type: xctest + test-special-entitlements: false flank: max-test-shards: 1 diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/IosRunCommandTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/IosRunCommandTest.kt index f86b076a92..32d69dc69a 100644 --- a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/IosRunCommandTest.kt +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/IosRunCommandTest.kt @@ -398,4 +398,12 @@ class IosRunCommandTest { assertThat(cmd.config.common.gcloud.type).isEqualTo("a") } + + @Test + fun `should properly parse test-special-entitlements`() { + val cmd = IosRunCommand() + CommandLine(cmd).parseArgs("--test-special-entitlements") + + assertThat(cmd.config.platform.gcloud.testSpecialEntitlements).isEqualTo(true) + } }