Skip to content

Commit f263bd7

Browse files
committed
Add a way to pass in orchestrator option when calling FTL
Test: usage in androidx.dev
1 parent 09b9ac4 commit f263bd7

File tree

7 files changed

+30
-10
lines changed

7 files changed

+30
-10
lines changed

AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import dev.androidx.ci.firebase.FirebaseTestLabApi
2121
import dev.androidx.ci.firebase.dto.EnvironmentType
2222
import dev.androidx.ci.generated.ftl.AndroidDevice
2323
import dev.androidx.ci.generated.ftl.AndroidDeviceList
24+
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
2425
import dev.androidx.ci.generated.ftl.ClientInfo
2526
import dev.androidx.ci.generated.ftl.EnvironmentMatrix
2627
import dev.androidx.ci.generated.ftl.ShardingOption
@@ -112,7 +113,8 @@ internal class FirebaseTestLabController(
112113
cachedTestMatrixFilter: CachedTestMatrixFilter,
113114
testTargets: List<String>? = null,
114115
flakyTestAttempts: Int = 2,
115-
testTimeoutSeconds: Int = 2700
116+
testTimeoutSeconds: Int = 2700,
117+
orchestratorOption: OrchestratorOption = OrchestratorOption.DO_NOT_USE_ORCHESTRATOR,
116118
): List<TestMatrix> {
117119
val devices = (devicePicker ?: defaultDevicePicker).pickDevices()
118120
logger.info {
@@ -131,7 +133,8 @@ internal class FirebaseTestLabController(
131133
cachedTestMatrixFilter = cachedTestMatrixFilter,
132134
testTargets = testTargets,
133135
flakyTestAttempts = flakyTestAttempts,
134-
testTimeoutSeconds = testTimeoutSeconds
136+
testTimeoutSeconds = testTimeoutSeconds,
137+
orchestratorOption = orchestratorOption,
135138
)
136139
}
137140
}

AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import dev.androidx.ci.firebase.FirebaseTestLabApi
2222
import dev.androidx.ci.firebase.ToolsResultApi
2323
import dev.androidx.ci.gcloud.GcsPath
2424
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest
25+
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
2526
import dev.androidx.ci.generated.ftl.ClientInfo
2627
import dev.androidx.ci.generated.ftl.EnvironmentMatrix
2728
import dev.androidx.ci.generated.ftl.FileReference
@@ -72,7 +73,8 @@ internal class TestMatrixStore(
7273
cachedTestMatrixFilter: CachedTestMatrixFilter = { true },
7374
testTargets: List<String>? = null,
7475
flakyTestAttempts: Int = 2,
75-
testTimeoutSeconds: Int = 2700
76+
testTimeoutSeconds: Int = 2700,
77+
orchestratorOption: OrchestratorOption = OrchestratorOption.DO_NOT_USE_ORCHESTRATOR,
7678
): TestMatrix {
7779

7880
val testRunId = TestRun.createId(
@@ -82,7 +84,8 @@ internal class TestMatrixStore(
8284
sharding = sharding,
8385
appApk = appApk.apkInfo,
8486
testApk = testApk.apkInfo,
85-
deviceSetup = deviceSetup
87+
deviceSetup = deviceSetup,
88+
orchestratorOption = orchestratorOption,
8689
)
8790
logger.trace {
8891
"test run id: $testRunId"
@@ -302,7 +305,8 @@ internal class TestMatrixStore(
302305
gcsPath = testApk.gcsPath.path
303306
),
304307
shardingOption = sharding,
305-
testTargets = testTargets
308+
testTargets = testTargets,
309+
orchestratorOption = deviceSetup?.orchestratorOption
306310
),
307311
testSetup = testSetup
308312
)

AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import dev.androidx.ci.firebase.ToolsResultApi
99
import dev.androidx.ci.gcloud.GcsPath
1010
import dev.androidx.ci.gcloud.GoogleCloudApi
1111
import dev.androidx.ci.generated.ftl.AndroidDevice
12+
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest
13+
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
1214
import dev.androidx.ci.generated.ftl.ClientInfo
1315
import dev.androidx.ci.generated.ftl.ShardingOption
1416
import dev.androidx.ci.generated.ftl.TestEnvironmentCatalog
@@ -83,7 +85,8 @@ interface TestRunnerService {
8385
cachedTestMatrixFilter: CachedTestMatrixFilter = { true },
8486
testTargets: List<String>? = null,
8587
flakyTestAttempts: Int = 2,
86-
testTimeoutSeconds: Int = 2700
88+
testTimeoutSeconds: Int = 2700,
89+
orchestratorOption: OrchestratorOption = OrchestratorOption.DO_NOT_USE_ORCHESTRATOR,
8790
): ScheduleTestsResponse
8891

8992
/**

AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import dev.androidx.ci.gcloud.BlobVisitor
2222
import dev.androidx.ci.gcloud.GcsPath
2323
import dev.androidx.ci.gcloud.GoogleCloudApi
2424
import dev.androidx.ci.generated.ftl.AndroidDevice
25+
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
2526
import dev.androidx.ci.generated.ftl.ClientInfo
2627
import dev.androidx.ci.generated.ftl.ShardingOption
2728
import dev.androidx.ci.generated.ftl.TestEnvironmentCatalog
@@ -103,7 +104,8 @@ internal class TestRunnerServiceImpl internal constructor(
103104
cachedTestMatrixFilter: CachedTestMatrixFilter,
104105
testTargets: List<String>?,
105106
flakyTestAttempts: Int,
106-
testTimeoutSeconds: Int
107+
testTimeoutSeconds: Int,
108+
orchestratorOption: OrchestratorOption,
107109
): TestRunnerService.ScheduleTestsResponse {
108110
val testMatrices = testLabController.submitTests(
109111
appApk = appApk ?: apkStore.getPlaceholderApk(),

AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/dto/TestRun.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import com.google.cloud.datastore.Key
2323
import com.squareup.moshi.Moshi
2424
import com.squareup.moshi.Types
2525
import dev.androidx.ci.datastore.DatastoreApi
26+
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
2627
import dev.androidx.ci.generated.ftl.ClientInfo
2728
import dev.androidx.ci.generated.ftl.EnvironmentMatrix
2829
import dev.androidx.ci.generated.ftl.ShardingOption
@@ -72,7 +73,8 @@ internal class TestRun(
7273
appApk: ApkInfo,
7374
testApk: ApkInfo,
7475
deviceSetup: DeviceSetup?,
75-
sharding: ShardingOption?
76+
sharding: ShardingOption?,
77+
orchestratorOption: OrchestratorOption?,
7678
): Id {
7779
val json = adapter.toJson(
7880
mapOf(
@@ -87,6 +89,7 @@ internal class TestRun(
8789
"additionalApks" to deviceSetup?.additionalApks?.map {
8890
it.gcsPath.path
8991
}, // The order we install additional apks is important, so we do not sort here.
92+
"orchestratorOption" to deviceSetup?.orchestratorOption,
9093
"directoriesToPull" to deviceSetup?.directoriesToPull?.sorted()
9194
)
9295
)

AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/vo/DeviceSetup.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dev.androidx.ci.testRunner.vo
22

3+
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
34
import dev.androidx.ci.generated.ftl.Apk
45
import dev.androidx.ci.generated.ftl.EnvironmentVariable
56
import dev.androidx.ci.generated.ftl.FileReference
@@ -25,7 +26,9 @@ data class DeviceSetup(
2526
/**
2627
* List of instrumentation arguments to be passed into the runner.
2728
*/
28-
val instrumentationArguments: List<InstrumentationArgument>? = null
29+
val instrumentationArguments: List<InstrumentationArgument>? = null,
30+
31+
var orchestratorOption: OrchestratorOption = OrchestratorOption.DO_NOT_USE_ORCHESTRATOR
2932
) {
3033
internal fun toTestSetup(): TestSetup {
3134
return TestSetup(

AndroidXCI/lib/src/test/kotlin/dev/androidx/ci/testRunner/TestMatrixStoreTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import dev.androidx.ci.fake.FakeToolsResultApi
2323
import dev.androidx.ci.gcloud.GcsPath
2424
import dev.androidx.ci.generated.ftl.AndroidDevice
2525
import dev.androidx.ci.generated.ftl.AndroidDeviceList
26+
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
2627
import dev.androidx.ci.generated.ftl.ClientInfo
2728
import dev.androidx.ci.generated.ftl.ClientInfoDetail
2829
import dev.androidx.ci.generated.ftl.EnvironmentMatrix
@@ -340,7 +341,8 @@ internal class TestMatrixStoreTest {
340341
sharding = ShardingOption(),
341342
appApk = createFakeApk("app.pak").apkInfo,
342343
testApk = createFakeApk("test.apk").apkInfo,
343-
deviceSetup = DeviceSetup()
344+
deviceSetup = DeviceSetup(),
345+
orchestratorOption = OrchestratorOption.DO_NOT_USE_ORCHESTRATOR,
344346
)
345347

346348
val resultGcsPath1 = store.createUniqueResultGcsPath(testRunId)

0 commit comments

Comments
 (0)