Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abandoned: feat: added max-test-shards and client-details to additional-app-test-apks #1898

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
25c5108
added maxTestShards and clientDetails
May 5, 2021
b1e9726
Merge branch 'master' into asalman/additional-config2
Sloox May 6, 2021
027c7f0
Merge branch 'master' into asalman/additional-config2
Sloox May 6, 2021
63f6ff1
format fixes
May 6, 2021
f89142c
Merge branch 'asalman/additional-config2' of github.com:asadsalman/fl…
May 6, 2021
74bb34b
Merge branch 'master' into asalman/additional-config2
Sloox May 7, 2021
b64f21a
removed wildcard import
May 7, 2021
58502bf
Merge branch 'master' into asalman/additional-config2
Sloox May 10, 2021
32b13d5
removed unused field
May 13, 2021
fd3aa15
Merge branch 'asalman/additional-config2' of github.com:asadsalman/fl…
May 13, 2021
466ff84
Merge branch 'master' into asalman/additional-config2
Sloox May 13, 2021
5be06e0
AppTestPair configs now show up on stdout under AndroidArgs
May 13, 2021
29358a4
Merge branch 'asalman/additional-config2' of github.com:asadsalman/fl…
May 13, 2021
86fb669
fixed existing tests
May 13, 2021
2cc47f7
format fix
May 13, 2021
fcf94f1
removed prints
May 13, 2021
5de877f
added max-test-shards to ArgsToString
May 13, 2021
00c6ceb
removed wildcard import, fixed test
May 14, 2021
a45552c
added test for max-test-shards cli parsing
May 14, 2021
3bbef74
testing shard count/size for additional-test-apks
May 14, 2021
c9ed300
MockServer now supports client details
May 15, 2021
5eb36a6
fixed client-details, added tests
May 15, 2021
262cfb1
fixed warnings
May 17, 2021
2d32a96
Merge branch 'master' into asalman/additional-config2
Sloox May 18, 2021
b06552a
changed line break
May 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions test_runner/src/main/kotlin/ftl/args/CreateAndroidArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,20 @@ fun createAndroidArgs(
roboScript = gcloud.roboScript?.normalizeFilePath(),

// flank
additionalAppTestApks = flank.additionalAppTestApks?.map { (app, test, env) ->
additionalAppTestApks = flank.additionalAppTestApks?.map {
// if additional-pair did not provide certain values, set as top level ones
val mergedClientDetails = mutableMapOf<String, String>().apply {
// merge additionalAppTestApk's client-details with top-level client-details
putAll(commonArgs.clientDetails ?: emptyMap())
putAll(it.clientDetails)
}

AppTestPair(
app = app?.normalizeFilePath(),
test = test.normalizeFilePath(),
environmentVariables = env
app = it.app?.normalizeFilePath(),
test = it.test.normalizeFilePath(),
environmentVariables = it.environmentVariables,
maxTestShards = if (it.maxTestShards == -1) commonArgs.maxTestShards else it.maxTestShards,
clientDetails = mergedClientDetails
)
} ?: emptyList(),
useLegacyJUnitResult = flank::useLegacyJUnitResult.require(),
Expand Down
12 changes: 11 additions & 1 deletion test_runner/src/main/kotlin/ftl/args/yml/AppTestPair.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
package ftl.args.yml

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory


@JsonIgnoreProperties(ignoreUnknown = true)
data class AppTestPair(
val app: String?,
val test: String,
@JsonProperty("environment-variables")
val environmentVariables: Map<String, String> = emptyMap()
val environmentVariables: Map<String, String> = emptyMap(),
@JsonProperty("max-test-shards")
val maxTestShards: Int = -1,
@JsonProperty("client-details")
var clientDetails: Map<String, String> = emptyMap()
)
13 changes: 9 additions & 4 deletions test_runner/src/main/kotlin/ftl/gc/GcAndroidTestMatrix.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ object GcAndroidTestMatrix {
obbFiles: Map<String, String>
): Testing.Projects.TestMatrices.Create {
// https://github.com/bootstraponline/studio-google-cloud-testing/blob/203ed2890c27a8078cd1b8f7ae12cf77527f426b/firebase-testing/src/com/google/gct/testing/launcher/CloudTestsLauncher.java#L120
val clientInfo = ClientInfo()
.setName("Flank")
.setClientInfoDetails(args.clientDetails?.toClientInfoDetailList())

val clientInfo = if (androidTestConfig is AndroidTestConfig.Instrumentation && androidTestConfig.clientDetails.isNotEmpty()) {
ClientInfo()
asadsalman marked this conversation as resolved.
Show resolved Hide resolved
.setName("Flank")
.setClientInfoDetails(androidTestConfig.clientDetails.toClientInfoDetailList())
} else {
ClientInfo()
.setName("Flank")
.setClientInfoDetails(args.clientDetails?.toClientInfoDetailList())
}
val matrixGcsPath = join(args.resultsBucket, runGcsPath)

// --auto-google-login
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ data class InstrumentationTestContext(
val shards: List<Chunk> = emptyList(),
val ignoredTestCases: IgnoredTestCases = emptyList(),
val environmentVariables: Map<String, String> = emptyMap(),
val testTargetsForShard: ShardChunks = emptyList()
val testTargetsForShard: ShardChunks = emptyList(),
val maxTestShards: Int = 0,
val clientDetails: Map<String, String> = emptyMap()
) : AndroidTestContext()

data class RoboTestContext(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ sealed class AndroidTestConfig {
val numUniformShards: Int?,
val keepTestTargetsEmpty: Boolean,
val environmentVariables: Map<String, String> = emptyMap(),
val testTargetsForShard: ShardChunks
val testTargetsForShard: ShardChunks,
val clientDetails: Map<String, String> = emptyMap()
) : AndroidTestConfig()

data class Robo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ private suspend fun List<AndroidTestContext>.setupShards(
testFilter: TestFilter = TestFilters.fromTestTargets(args.testTargets, args.testTargetsForShard)
): List<AndroidTestContext> = coroutineScope {
map { testContext ->
val newArgs = if (testContext is InstrumentationTestContext && testContext.maxTestShards > 0) {
args.copy(commonArgs = args.commonArgs.copy(maxTestShards = testContext.maxTestShards))
} else args
async {
when {
testContext !is InstrumentationTestContext -> testContext
args.useCustomSharding -> testContext.userShards(args.customSharding)
args.useTestTargetsForShard ->
testContext.downloadApks()
.calculateDummyShards(args, testFilter)
else -> testContext.downloadApks().calculateShards(args, testFilter)
newArgs.useCustomSharding -> testContext.userShards(newArgs.customSharding)
newArgs.useTestTargetsForShard -> testContext.downloadApks().calculateDummyShards(newArgs, testFilter)
else -> testContext.downloadApks().calculateShards(newArgs, testFilter)
}
}
}.awaitAll().dropEmptyInstrumentationTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import ftl.args.AndroidArgs
import ftl.args.isGameLoop
import ftl.args.isSanityRobo
import ftl.run.exception.FlankGeneralError
import ftl.run.model.AndroidTestContext
import ftl.run.model.GameLoopContext
import ftl.run.model.InstrumentationTestContext
import ftl.run.model.RoboTestContext
import ftl.run.model.SanityRoboTestContext
import ftl.run.model.*
import ftl.util.asFileReference

@VisibleForTesting
Expand Down Expand Up @@ -40,6 +36,8 @@ private fun AndroidArgs.additionalApksContexts() = additionalAppTestApks.map {
app = appApk.asFileReference(),
test = it.test.asFileReference(),
environmentVariables = it.environmentVariables,
testTargetsForShard = testTargetsForShard
testTargetsForShard = testTargetsForShard,
maxTestShards = it.maxTestShards,
clientDetails = it.clientDetails,
)
}.toTypedArray()