Skip to content

Commit 7386d66

Browse files
authored
Adding parameters for specifying testTargets and num of flakyAttempts in preparition for ftl retries (#69)
1 parent 772813c commit 7386d66

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ internal class FirebaseTestLabController(
110110
devicePicker: DevicePicker? = null,
111111
pullScreenshots: Boolean = false,
112112
cachedTestMatrixFilter: CachedTestMatrixFilter,
113+
testTargets: List<String>? = null,
114+
flakyTestAttempts: Int? = 2
113115
): List<TestMatrix> {
114116
val devices = (devicePicker ?: defaultDevicePicker).pickDevices()
115117
logger.info {
@@ -125,7 +127,9 @@ internal class FirebaseTestLabController(
125127
sharding = sharding,
126128
deviceSetup = deviceSetup,
127129
pullScreenshots = pullScreenshots,
128-
cachedTestMatrixFilter = cachedTestMatrixFilter
130+
cachedTestMatrixFilter = cachedTestMatrixFilter,
131+
testTargets = testTargets,
132+
flakyTestAttempts = flakyTestAttempts
129133
)
130134
}
131135
}

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ internal class TestMatrixStore(
6969
deviceSetup: DeviceSetup?,
7070
pullScreenshots: Boolean = false,
7171
cachedTestMatrixFilter: CachedTestMatrixFilter = { true },
72+
testTargets: List<String>? = null,
73+
flakyTestAttempts: Int? = 2
7274
): TestMatrix {
7375

7476
val testRunId = TestRun.createId(
@@ -114,7 +116,9 @@ internal class TestMatrixStore(
114116
deviceSetup = deviceSetup,
115117
appApk = appApk,
116118
testApk = testApk,
117-
pullScreenshots = pullScreenshots
119+
pullScreenshots = pullScreenshots,
120+
testTargets = testTargets,
121+
flakyTestAttempts = flakyTestAttempts
118122
)
119123
)
120124
logger.info {
@@ -177,7 +181,9 @@ internal class TestMatrixStore(
177181
deviceSetup: DeviceSetup?,
178182
appApk: UploadedApk,
179183
testApk: UploadedApk,
180-
pullScreenshots: Boolean = false
184+
pullScreenshots: Boolean = false,
185+
testTargets: List<String>? = null,
186+
flakyTestAttempts: Int? = 2
181187
): TestMatrix {
182188
val packageName = firebaseTestLabApi.getApkDetails(
183189
FileReference(
@@ -206,7 +212,7 @@ internal class TestMatrixStore(
206212
}
207213
return TestMatrix(
208214
projectId = firebaseProjectId,
209-
flakyTestAttempts = 2,
215+
flakyTestAttempts = flakyTestAttempts,
210216
testSpecification = TestSpecification(
211217
testTimeout = "2700s", // Limit for physical devices.
212218
disableVideoRecording = false,
@@ -218,7 +224,8 @@ internal class TestMatrixStore(
218224
testApk = FileReference(
219225
gcsPath = testApk.gcsPath.path
220226
),
221-
shardingOption = sharding
227+
shardingOption = sharding,
228+
testTargets = testTargets
222229
),
223230
testSetup = testSetup
224231
),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ interface TestRunnerService {
8080
devicePicker: (TestEnvironmentCatalog) -> List<AndroidDevice>,
8181
pullScreenshots: Boolean = false,
8282
cachedTestMatrixFilter: CachedTestMatrixFilter = { true },
83+
testTargets: List<String>? = null,
84+
flakyTestAttempts: Int? = 2
8385
): ScheduleTestsResponse
8486

8587
/**

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ internal class TestRunnerServiceImpl internal constructor(
100100
devicePicker: (TestEnvironmentCatalog) -> List<AndroidDevice>,
101101
pullScreenshots: Boolean,
102102
cachedTestMatrixFilter: CachedTestMatrixFilter,
103+
testTargets: List<String>?,
104+
flakyTestAttempts: Int?
103105
): TestRunnerService.ScheduleTestsResponse {
104106
val testMatrices = testLabController.submitTests(
105107
appApk = appApk ?: apkStore.getPlaceholderApk(),
@@ -109,7 +111,9 @@ internal class TestRunnerServiceImpl internal constructor(
109111
deviceSetup = deviceSetup,
110112
devicePicker = devicePicker,
111113
pullScreenshots = pullScreenshots,
112-
cachedTestMatrixFilter = cachedTestMatrixFilter
114+
cachedTestMatrixFilter = cachedTestMatrixFilter,
115+
testTargets = testTargets,
116+
flakyTestAttempts = flakyTestAttempts
113117
)
114118
return TestRunnerService.ScheduleTestsResponse.create(
115119
testMatrices

0 commit comments

Comments
 (0)