Skip to content

Commit

Permalink
Fix env from additional apks not override default values
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelpasterz authored and mergify-bot committed Aug 9, 2021
1 parent f05cc03 commit a0605ad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,18 @@ private fun AndroidArgs.additionalApksContexts() = additionalAppTestApks.map {
InstrumentationTestContext(
app = appApk.asFileReference(),
test = it.test.asFileReference(),
environmentVariables = it.environmentVariables,
environmentVariables = it.environmentVariables.takeIf { envs -> envs.isNotEmpty() } ?: environmentVariables,
testTargetsForShard = testTargetsForShard,
args = copy(
commonArgs = commonArgs.copy(
maxTestShards = it.maxTestShards ?: maxTestShards,
devices = it.devices ?: devices,
clientDetails = it.clientDetails ?: clientDetails
),
testApk = it.test,
testTargets = it.testTargets ?: testTargets,
parameterizedTests = it.parameterizedTests ?: parameterizedTests
parameterizedTests = it.parameterizedTests ?: parameterizedTests,
environmentVariables = it.environmentVariables.takeIf { envs -> envs.isNotEmpty() } ?: environmentVariables,
)
)
}.toTypedArray()
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,24 @@ class CreateAndroidTestContextKtTest {
test = should { local.endsWith("app-single-success-debug-androidTest.apk") },
shards = should { size == 1 },
ignoredTestCases = should { size == 2 },
args = should { maxTestShards == 1 }
environmentVariables = should { equals(args.environmentVariables) },
args = should {
maxTestShards == 1 &&
testApk?.endsWith("app-single-success-debug-androidTest.apk") == true &&
environmentVariables == args.environmentVariables
}
),
InstrumentationTestContext(
app = should { local.endsWith("app-debug.apk") },
test = should { local.endsWith("app-multiple-flaky-debug-androidTest.apk") },
shards = should { size == 2 },
ignoredTestCases = should { size == 2 },
args = should { testTargets == listOf("class com.example.test_app.InstrumentedTest") }
environmentVariables = should { equals(args.environmentVariables) },
args = should {
testTargets == listOf("class com.example.test_app.InstrumentedTest") &&
testApk?.endsWith("app-multiple-flaky-debug-androidTest.apk") == true &&
environmentVariables == args.environmentVariables
}
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ResolveApksKtTest {
InstrumentationTestContext(
app = "app".asFileReference(),
test = "test".asFileReference(),
args = args
args = args.copy(testApk = "test")
)
),
args.resolveApks().toTypedArray()
Expand Down

0 comments on commit a0605ad

Please sign in to comment.