Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import dev.androidx.ci.firebase.FirebaseTestLabApi
import dev.androidx.ci.firebase.dto.EnvironmentType
import dev.androidx.ci.generated.ftl.AndroidDevice
import dev.androidx.ci.generated.ftl.AndroidDeviceList
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
import dev.androidx.ci.generated.ftl.ClientInfo
import dev.androidx.ci.generated.ftl.EnvironmentMatrix
import dev.androidx.ci.generated.ftl.ShardingOption
Expand Down Expand Up @@ -112,7 +113,8 @@ internal class FirebaseTestLabController(
cachedTestMatrixFilter: CachedTestMatrixFilter,
testTargets: List<String>? = null,
flakyTestAttempts: Int = 2,
testTimeoutSeconds: Int = 2700
testTimeoutSeconds: Int = 2700,
orchestratorOption: OrchestratorOption? = null,
): List<TestMatrix> {
val devices = (devicePicker ?: defaultDevicePicker).pickDevices()
logger.info {
Expand All @@ -131,7 +133,8 @@ internal class FirebaseTestLabController(
cachedTestMatrixFilter = cachedTestMatrixFilter,
testTargets = testTargets,
flakyTestAttempts = flakyTestAttempts,
testTimeoutSeconds = testTimeoutSeconds
testTimeoutSeconds = testTimeoutSeconds,
orchestratorOption = orchestratorOption,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import dev.androidx.ci.firebase.FirebaseTestLabApi
import dev.androidx.ci.firebase.ToolsResultApi
import dev.androidx.ci.gcloud.GcsPath
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
import dev.androidx.ci.generated.ftl.ClientInfo
import dev.androidx.ci.generated.ftl.EnvironmentMatrix
import dev.androidx.ci.generated.ftl.FileReference
Expand Down Expand Up @@ -72,7 +73,8 @@ internal class TestMatrixStore(
cachedTestMatrixFilter: CachedTestMatrixFilter = { true },
testTargets: List<String>? = null,
flakyTestAttempts: Int = 2,
testTimeoutSeconds: Int = 2700
testTimeoutSeconds: Int = 2700,
orchestratorOption: OrchestratorOption? = null,
): TestMatrix {

val testRunId = TestRun.createId(
Expand All @@ -82,7 +84,8 @@ internal class TestMatrixStore(
sharding = sharding,
appApk = appApk.apkInfo,
testApk = testApk.apkInfo,
deviceSetup = deviceSetup
deviceSetup = deviceSetup,
orchestratorOption = orchestratorOption,
)
logger.trace {
"test run id: $testRunId"
Expand Down Expand Up @@ -263,7 +266,8 @@ internal class TestMatrixStore(
pullScreenshots: Boolean = false,
testTargets: List<String>? = null,
flakyTestAttempts: Int = 2,
testTimeoutSeconds: Int = 2700
testTimeoutSeconds: Int = 2700,
orchestratorOption: OrchestratorOption? = null,
): TestMatrix {
val packageName = firebaseTestLabApi.getApkDetails(
FileReference(
Expand Down Expand Up @@ -302,7 +306,8 @@ internal class TestMatrixStore(
gcsPath = testApk.gcsPath.path
),
shardingOption = sharding,
testTargets = testTargets
testTargets = testTargets,
orchestratorOption = orchestratorOption
),
testSetup = testSetup
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import dev.androidx.ci.firebase.ToolsResultApi
import dev.androidx.ci.gcloud.GcsPath
import dev.androidx.ci.gcloud.GoogleCloudApi
import dev.androidx.ci.generated.ftl.AndroidDevice
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
import dev.androidx.ci.generated.ftl.ClientInfo
import dev.androidx.ci.generated.ftl.ShardingOption
import dev.androidx.ci.generated.ftl.TestEnvironmentCatalog
Expand Down Expand Up @@ -83,7 +84,8 @@ interface TestRunnerService {
cachedTestMatrixFilter: CachedTestMatrixFilter = { true },
testTargets: List<String>? = null,
flakyTestAttempts: Int = 2,
testTimeoutSeconds: Int = 2700
testTimeoutSeconds: Int = 2700,
orchestratorOption: OrchestratorOption? = null,
): ScheduleTestsResponse

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import dev.androidx.ci.gcloud.BlobVisitor
import dev.androidx.ci.gcloud.GcsPath
import dev.androidx.ci.gcloud.GoogleCloudApi
import dev.androidx.ci.generated.ftl.AndroidDevice
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
import dev.androidx.ci.generated.ftl.ClientInfo
import dev.androidx.ci.generated.ftl.ShardingOption
import dev.androidx.ci.generated.ftl.TestEnvironmentCatalog
Expand Down Expand Up @@ -103,7 +104,8 @@ internal class TestRunnerServiceImpl internal constructor(
cachedTestMatrixFilter: CachedTestMatrixFilter,
testTargets: List<String>?,
flakyTestAttempts: Int,
testTimeoutSeconds: Int
testTimeoutSeconds: Int,
orchestratorOption: OrchestratorOption?,
): TestRunnerService.ScheduleTestsResponse {
val testMatrices = testLabController.submitTests(
appApk = appApk ?: apkStore.getPlaceholderApk(),
Expand All @@ -116,7 +118,8 @@ internal class TestRunnerServiceImpl internal constructor(
cachedTestMatrixFilter = cachedTestMatrixFilter,
testTargets = testTargets,
flakyTestAttempts = flakyTestAttempts,
testTimeoutSeconds = testTimeoutSeconds
testTimeoutSeconds = testTimeoutSeconds,
orchestratorOption = orchestratorOption,
)
return TestRunnerService.ScheduleTestsResponse.create(
testMatrices
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ internal sealed interface TestScheduler {
).filter {
it.entry.name.endsWith("AndroidTest.json")
}.mapNotNull { zipEntryScope ->
adapter.fromJson(zipEntryScope.bytes.toString(Charsets.UTF_8)).also { testRunConfig ->
adapter.fromJson(zipEntryScope.bytes.toString(Charsets.UTF_8)).also { _ ->
"Found AndroidTest config: ${zipEntryScope.entry.name}"
}
}.filter { testRunConfig ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.google.cloud.datastore.Key
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types
import dev.androidx.ci.datastore.DatastoreApi
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
import dev.androidx.ci.generated.ftl.ClientInfo
import dev.androidx.ci.generated.ftl.EnvironmentMatrix
import dev.androidx.ci.generated.ftl.ShardingOption
Expand Down Expand Up @@ -72,7 +73,8 @@ internal class TestRun(
appApk: ApkInfo,
testApk: ApkInfo,
deviceSetup: DeviceSetup?,
sharding: ShardingOption?
sharding: ShardingOption?,
orchestratorOption: OrchestratorOption?,
): Id {
val json = adapter.toJson(
mapOf(
Expand All @@ -88,7 +90,7 @@ internal class TestRun(
it.gcsPath.path
}, // The order we install additional apks is important, so we do not sort here.
"directoriesToPull" to deviceSetup?.directoriesToPull?.sorted()
)
) + if (orchestratorOption != null) mapOf("orchestratorOption" to orchestratorOption) else mapOf()
)
val sha = sha256(json.toByteArray(Charsets.UTF_8))
return Id(datastoreApi.createKey(datastoreApi.testRunObjectKind, sha))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import dev.androidx.ci.fake.FakeToolsResultApi
import dev.androidx.ci.gcloud.GcsPath
import dev.androidx.ci.generated.ftl.AndroidDevice
import dev.androidx.ci.generated.ftl.AndroidDeviceList
import dev.androidx.ci.generated.ftl.AndroidInstrumentationTest.OrchestratorOption
import dev.androidx.ci.generated.ftl.ClientInfo
import dev.androidx.ci.generated.ftl.ClientInfoDetail
import dev.androidx.ci.generated.ftl.EnvironmentMatrix
Expand Down Expand Up @@ -340,7 +341,8 @@ internal class TestMatrixStoreTest {
sharding = ShardingOption(),
appApk = createFakeApk("app.pak").apkInfo,
testApk = createFakeApk("test.apk").apkInfo,
deviceSetup = DeviceSetup()
deviceSetup = DeviceSetup(),
orchestratorOption = OrchestratorOption.DO_NOT_USE_ORCHESTRATOR,
)

val resultGcsPath1 = store.createUniqueResultGcsPath(testRunId)
Expand Down
Loading