From 95b54f82bb71d381b5974f13914476bda356a996 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Mon, 2 Nov 2020 10:14:30 +0100 Subject: [PATCH 1/5] Commit for testing puposes --- docs/index.md | 7 +++++++ test_runner/flank.ios.yml | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/docs/index.md b/docs/index.md index 4366640083..616d8976ae 100644 --- a/docs/index.md +++ b/docs/index.md @@ -169,6 +169,13 @@ gcloud: ## The type of iOS test to run. TYPE must be one of: xctest, game-loop. Default: xctest # type: xctest + + ## The path to the application archive (.ipa file) for game-loop testing. + ## The path may be in the local filesystem or in Google Cloud Storage using gs:// notation. + ## This flag is only valid when --type=game-loop is also set + # app: + # - gs://bucket/additional.ipa OR path/to/local/ipa/file.ipa + flank: # -- FlankYml -- diff --git a/test_runner/flank.ios.yml b/test_runner/flank.ios.yml index 5c50560f56..1eca4a5c1e 100644 --- a/test_runner/flank.ios.yml +++ b/test_runner/flank.ios.yml @@ -98,6 +98,12 @@ gcloud: # - 2 # - 3 + ## The path to the application archive (.ipa file) for game-loop testing. + ## The path may be in the local filesystem or in Google Cloud Storage using gs:// notation. + ## This flag is only valid when --type=game-loop is also set + # app: + # - gs://bucket/additional.ipa OR path/to/local/ipa/file.ipa + ## The type of iOS test to run. TYPE must be one of: xctest, game-loop. Default: xctest # type: xctest From ce8930ebd579525933e1843103c04db09428bf10 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Mon, 2 Nov 2020 10:41:45 +0100 Subject: [PATCH 2/5] Added app for ios v1 --- test_runner/src/main/kotlin/ftl/args/CreateIosArgs.kt | 3 ++- test_runner/src/main/kotlin/ftl/args/IosArgs.kt | 4 +++- .../src/main/kotlin/ftl/args/ValidateIosArgs.kt | 11 ++++++++++- .../src/main/kotlin/ftl/config/ios/IosGcloudConfig.kt | 10 ++++++++++ test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt | 3 +++ 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/test_runner/src/main/kotlin/ftl/args/CreateIosArgs.kt b/test_runner/src/main/kotlin/ftl/args/CreateIosArgs.kt index 6a5b1aac14..7d9c74cdc7 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, + app = gcloud.app?.normalizeFilePath().orEmpty() ) 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 017dee948f..0d264ba2b4 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 app: String, ) : IArgs by commonArgs { override val useLegacyJUnitResult = true @@ -44,6 +45,7 @@ IosArgs additional-ipas: ${ArgsToString.listToString(additionalIpas)} scenario-numbers: ${ArgsToString.listToString(scenarioNumbers)} type: ${type?.ymlName} + app: $app flank: max-test-shards: $maxTestShards diff --git a/test_runner/src/main/kotlin/ftl/args/ValidateIosArgs.kt b/test_runner/src/main/kotlin/ftl/args/ValidateIosArgs.kt index bc0bb848a0..52e74363b8 100644 --- a/test_runner/src/main/kotlin/ftl/args/ValidateIosArgs.kt +++ b/test_runner/src/main/kotlin/ftl/args/ValidateIosArgs.kt @@ -18,7 +18,16 @@ fun IosArgs.validate() = apply { assertGameloop() } -fun IosArgs.assertGameloop() { +private fun IosArgs.assertGameloop() { + validateApp() + validateScenarioNumbers() +} + +private fun IosArgs.validateApp() { + if (app.isNotEmpty() && type != Type.GAMELOOP) throw FlankConfigurationError("App cannot be defined if type is not equal to game-loop (IOS)") +} + +private fun IosArgs.validateScenarioNumbers() { if (scenarioNumbers.isNotEmpty() && (type != Type.GAMELOOP)) throw FlankConfigurationError("Scenario numbers defined but Type is not Game-loop.") scenarioNumbers.forEach { it.toIntOrNull() ?: throw FlankConfigurationError("Invalid scenario number provided - $it") } 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..6ec79082be 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,16 @@ data class IosGcloudConfig @JsonIgnore constructor( @set:JsonProperty("additional-ipas") var additionalIpas: List? by data + @set:CommandLine.Option( + names = ["--app"], + split = ",", + description = ["The path to the application archive (.ipa file) for game-loop testing. " + + "The path may be in the local filesystem or in Google Cloud Storage using gs:// notation. " + + "This flag is only valid when --type=game-loop is also set"] + ) + @set:JsonProperty("app") + var app: String? by data + constructor() : this(mutableMapOf().withDefault { null }) companion object : IYmlKeys { diff --git a/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt b/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt index e9460a3ec3..c4668020e2 100644 --- a/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt +++ b/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt @@ -243,6 +243,7 @@ IosArgs - $testIpa2 scenario-numbers: type: xctest + app: flank: max-test-shards: 7 @@ -304,6 +305,8 @@ IosArgs additional-ipas: scenario-numbers: type: xctest + app: + flank: max-test-shards: 1 From 58f8c64667edf85bdc730bb1081add549f6790e1 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Mon, 2 Nov 2020 11:00:48 +0100 Subject: [PATCH 3/5] Added tests and fixed crashes --- .../kotlin/ftl/config/ios/IosGcloudConfig.kt | 1 - .../src/test/kotlin/ftl/args/IosArgsTest.kt | 26 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) 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 6ec79082be..2fe534089b 100644 --- a/test_runner/src/main/kotlin/ftl/config/ios/IosGcloudConfig.kt +++ b/test_runner/src/main/kotlin/ftl/config/ios/IosGcloudConfig.kt @@ -60,7 +60,6 @@ data class IosGcloudConfig @JsonIgnore constructor( @set:CommandLine.Option( names = ["--app"], - split = ",", description = ["The path to the application archive (.ipa file) for game-loop testing. " + "The path may be in the local filesystem or in Google Cloud Storage using gs:// notation. " + "This flag is only valid when --type=game-loop is also set"] diff --git a/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt b/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt index c4668020e2..9f9a36475e 100644 --- a/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt +++ b/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt @@ -306,7 +306,6 @@ IosArgs scenario-numbers: type: xctest app: - flank: max-test-shards: 1 @@ -1188,6 +1187,31 @@ IosArgs """.trimIndent() IosArgs.load(yaml).validate() } + + @Test(expected = FlankConfigurationError::class) + fun `should throw exception if app provided but not type equals gameloop`() { + val yaml = """ + gcloud: + test: $testPath + xctestrun-file: $testPath + results-dir: test + app: $testPath + """.trimIndent() + IosArgs.load(yaml).validate() + } + + @Test + fun `should not throw exception if app provided and type equals gameloop`() { + val yaml = """ + gcloud: + test: $testPath + xctestrun-file: $testPath + results-dir: test + type: game-loop + app: $testPath + """.trimIndent() + IosArgs.load(yaml).validate() + } } private fun IosArgs.Companion.load(yamlData: String, cli: IosRunCommand? = null): IosArgs = From 8b38cb01f90ffdacb1052c04325c3853c7c88be7 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Tue, 3 Nov 2020 09:43:41 +0100 Subject: [PATCH 4/5] add app defaults --- test_runner/src/main/kotlin/ftl/config/ios/IosGcloudConfig.kt | 1 + 1 file changed, 1 insertion(+) 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 2fe534089b..b66d9d7491 100644 --- a/test_runner/src/main/kotlin/ftl/config/ios/IosGcloudConfig.kt +++ b/test_runner/src/main/kotlin/ftl/config/ios/IosGcloudConfig.kt @@ -82,6 +82,7 @@ data class IosGcloudConfig @JsonIgnore constructor( xctestrunFile = null xcodeVersion = null additionalIpas = emptyList() + app = null } } } From 55c17df93a279e5d6f91b6bc9c51ae8e7fa7f7d2 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Tue, 3 Nov 2020 09:58:34 +0100 Subject: [PATCH 5/5] Fix tests after merge --- test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt b/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt index 3bd1ff8b52..78d11468d8 100644 --- a/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt +++ b/test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt @@ -309,8 +309,8 @@ IosArgs additional-ipas: scenario-numbers: type: xctest - test-special-entitlements: false app: + test-special-entitlements: false flank: max-test-shards: 1