From 9be90900ac145fbdaf0c4ba7a5b17e2ae9e74d34 Mon Sep 17 00:00:00 2001 From: Radha Nakade Date: Mon, 16 Sep 2024 13:22:25 -0700 Subject: [PATCH 1/3] Add a paramter to specify testTimeout in FTL controller. --- .../ci/testRunner/FirebaseTestLabController.kt | 6 ++++-- .../dev/androidx/ci/testRunner/TestMatrixStore.kt | 11 +++++++---- .../dev/androidx/ci/testRunner/TestRunnerService.kt | 3 ++- .../androidx/ci/testRunner/TestRunnerServiceImpl.kt | 6 ++++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt index 37ee7c2..6ceae1c 100644 --- a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt +++ b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt @@ -111,7 +111,8 @@ internal class FirebaseTestLabController( pullScreenshots: Boolean = false, cachedTestMatrixFilter: CachedTestMatrixFilter, testTargets: List? = null, - flakyTestAttempts: Int = 2 + flakyTestAttempts: Int = 2, + testTimeout: String = "2700s" ): List { val devices = (devicePicker ?: defaultDevicePicker).pickDevices() logger.info { @@ -129,7 +130,8 @@ internal class FirebaseTestLabController( pullScreenshots = pullScreenshots, cachedTestMatrixFilter = cachedTestMatrixFilter, testTargets = testTargets, - flakyTestAttempts = flakyTestAttempts + flakyTestAttempts = flakyTestAttempts, + testTimeout = testTimeout ) } } diff --git a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt index a7c1221..c2d0758 100644 --- a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt +++ b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt @@ -71,7 +71,8 @@ internal class TestMatrixStore( pullScreenshots: Boolean = false, cachedTestMatrixFilter: CachedTestMatrixFilter = { true }, testTargets: List? = null, - flakyTestAttempts: Int = 2 + flakyTestAttempts: Int = 2, + testTimeout: String = "2700s" ): TestMatrix { val testRunId = TestRun.createId( @@ -101,7 +102,8 @@ internal class TestMatrixStore( testApk = testApk, pullScreenshots = pullScreenshots, testTargets = testTargets, - flakyTestAttempts = flakyTestAttempts + flakyTestAttempts = flakyTestAttempts, + testTimeout = testTimeout ) logger.info { "created test matrix: $newTestMatrix" @@ -260,7 +262,8 @@ internal class TestMatrixStore( testApk: UploadedApk, pullScreenshots: Boolean = false, testTargets: List? = null, - flakyTestAttempts: Int = 2 + flakyTestAttempts: Int = 2, + testTimeout: String = "2700s" ): TestMatrix { val packageName = firebaseTestLabApi.getApkDetails( FileReference( @@ -288,7 +291,7 @@ internal class TestMatrixStore( ) } val testSpecification = TestSpecification( - testTimeout = "2700s", // Limit for physical devices. + testTimeout = testTimeout, disableVideoRecording = false, disablePerformanceMetrics = true, // Not a useful feature for androidx androidInstrumentationTest = AndroidInstrumentationTest( diff --git a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt index b426af0..df18b1b 100644 --- a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt +++ b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt @@ -82,7 +82,8 @@ interface TestRunnerService { pullScreenshots: Boolean = false, cachedTestMatrixFilter: CachedTestMatrixFilter = { true }, testTargets: List? = null, - flakyTestAttempts: Int = 2 + flakyTestAttempts: Int = 2, + testTimeout: String = "2700s" ): ScheduleTestsResponse /** diff --git a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt index 7fdb6a7..e77ba3f 100644 --- a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt +++ b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt @@ -102,7 +102,8 @@ internal class TestRunnerServiceImpl internal constructor( pullScreenshots: Boolean, cachedTestMatrixFilter: CachedTestMatrixFilter, testTargets: List?, - flakyTestAttempts: Int + flakyTestAttempts: Int, + testTimeout: String ): TestRunnerService.ScheduleTestsResponse { val testMatrices = testLabController.submitTests( appApk = appApk ?: apkStore.getPlaceholderApk(), @@ -114,7 +115,8 @@ internal class TestRunnerServiceImpl internal constructor( pullScreenshots = pullScreenshots, cachedTestMatrixFilter = cachedTestMatrixFilter, testTargets = testTargets, - flakyTestAttempts = flakyTestAttempts + flakyTestAttempts = flakyTestAttempts, + testTimeout = testTimeout ) return TestRunnerService.ScheduleTestsResponse.create( testMatrices From de68bc5181cadbdf60afcfe1d0a7315d75ad15e0 Mon Sep 17 00:00:00 2001 From: Radha Nakade Date: Mon, 16 Sep 2024 14:41:27 -0700 Subject: [PATCH 2/3] Update testTimeout to int --- .../dev/androidx/ci/testRunner/FirebaseTestLabController.kt | 2 +- .../kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt | 6 +++--- .../kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt | 2 +- .../dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt index 6ceae1c..f48e7e8 100644 --- a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt +++ b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt @@ -112,7 +112,7 @@ internal class FirebaseTestLabController( cachedTestMatrixFilter: CachedTestMatrixFilter, testTargets: List? = null, flakyTestAttempts: Int = 2, - testTimeout: String = "2700s" + testTimeout: Int = 2700 ): List { val devices = (devicePicker ?: defaultDevicePicker).pickDevices() logger.info { diff --git a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt index c2d0758..668abd8 100644 --- a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt +++ b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt @@ -72,7 +72,7 @@ internal class TestMatrixStore( cachedTestMatrixFilter: CachedTestMatrixFilter = { true }, testTargets: List? = null, flakyTestAttempts: Int = 2, - testTimeout: String = "2700s" + testTimeout: Int = 2700 ): TestMatrix { val testRunId = TestRun.createId( @@ -263,7 +263,7 @@ internal class TestMatrixStore( pullScreenshots: Boolean = false, testTargets: List? = null, flakyTestAttempts: Int = 2, - testTimeout: String = "2700s" + testTimeout: Int = 2700 ): TestMatrix { val packageName = firebaseTestLabApi.getApkDetails( FileReference( @@ -291,7 +291,7 @@ internal class TestMatrixStore( ) } val testSpecification = TestSpecification( - testTimeout = testTimeout, + testTimeout = "${testTimeout}s", disableVideoRecording = false, disablePerformanceMetrics = true, // Not a useful feature for androidx androidInstrumentationTest = AndroidInstrumentationTest( diff --git a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt index df18b1b..402b32f 100644 --- a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt +++ b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt @@ -83,7 +83,7 @@ interface TestRunnerService { cachedTestMatrixFilter: CachedTestMatrixFilter = { true }, testTargets: List? = null, flakyTestAttempts: Int = 2, - testTimeout: String = "2700s" + testTimeout: Int = 2700 ): ScheduleTestsResponse /** diff --git a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt index e77ba3f..8b350c6 100644 --- a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt +++ b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt @@ -103,7 +103,7 @@ internal class TestRunnerServiceImpl internal constructor( cachedTestMatrixFilter: CachedTestMatrixFilter, testTargets: List?, flakyTestAttempts: Int, - testTimeout: String + testTimeout: Int ): TestRunnerService.ScheduleTestsResponse { val testMatrices = testLabController.submitTests( appApk = appApk ?: apkStore.getPlaceholderApk(), From 300517d11eb5a5f3aee54ff64ef99ea041b39a17 Mon Sep 17 00:00:00 2001 From: Radha Nakade Date: Tue, 17 Sep 2024 07:27:56 -0700 Subject: [PATCH 3/3] update parameter name --- .../androidx/ci/testRunner/FirebaseTestLabController.kt | 4 ++-- .../kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt | 8 ++++---- .../dev/androidx/ci/testRunner/TestRunnerService.kt | 2 +- .../dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt index f48e7e8..f96aa41 100644 --- a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt +++ b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/FirebaseTestLabController.kt @@ -112,7 +112,7 @@ internal class FirebaseTestLabController( cachedTestMatrixFilter: CachedTestMatrixFilter, testTargets: List? = null, flakyTestAttempts: Int = 2, - testTimeout: Int = 2700 + testTimeoutSeconds: Int = 2700 ): List { val devices = (devicePicker ?: defaultDevicePicker).pickDevices() logger.info { @@ -131,7 +131,7 @@ internal class FirebaseTestLabController( cachedTestMatrixFilter = cachedTestMatrixFilter, testTargets = testTargets, flakyTestAttempts = flakyTestAttempts, - testTimeout = testTimeout + testTimeoutSeconds = testTimeoutSeconds ) } } diff --git a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt index 668abd8..d357e91 100644 --- a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt +++ b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestMatrixStore.kt @@ -72,7 +72,7 @@ internal class TestMatrixStore( cachedTestMatrixFilter: CachedTestMatrixFilter = { true }, testTargets: List? = null, flakyTestAttempts: Int = 2, - testTimeout: Int = 2700 + testTimeoutSeconds: Int = 2700 ): TestMatrix { val testRunId = TestRun.createId( @@ -103,7 +103,7 @@ internal class TestMatrixStore( pullScreenshots = pullScreenshots, testTargets = testTargets, flakyTestAttempts = flakyTestAttempts, - testTimeout = testTimeout + testTimeoutSeconds = testTimeoutSeconds ) logger.info { "created test matrix: $newTestMatrix" @@ -263,7 +263,7 @@ internal class TestMatrixStore( pullScreenshots: Boolean = false, testTargets: List? = null, flakyTestAttempts: Int = 2, - testTimeout: Int = 2700 + testTimeoutSeconds: Int = 2700 ): TestMatrix { val packageName = firebaseTestLabApi.getApkDetails( FileReference( @@ -291,7 +291,7 @@ internal class TestMatrixStore( ) } val testSpecification = TestSpecification( - testTimeout = "${testTimeout}s", + testTimeout = "${testTimeoutSeconds}s", disableVideoRecording = false, disablePerformanceMetrics = true, // Not a useful feature for androidx androidInstrumentationTest = AndroidInstrumentationTest( diff --git a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt index 402b32f..8cddce9 100644 --- a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt +++ b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerService.kt @@ -83,7 +83,7 @@ interface TestRunnerService { cachedTestMatrixFilter: CachedTestMatrixFilter = { true }, testTargets: List? = null, flakyTestAttempts: Int = 2, - testTimeout: Int = 2700 + testTimeoutSeconds: Int = 2700 ): ScheduleTestsResponse /** diff --git a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt index 8b350c6..2e3bed9 100644 --- a/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt +++ b/AndroidXCI/lib/src/main/kotlin/dev/androidx/ci/testRunner/TestRunnerServiceImpl.kt @@ -103,7 +103,7 @@ internal class TestRunnerServiceImpl internal constructor( cachedTestMatrixFilter: CachedTestMatrixFilter, testTargets: List?, flakyTestAttempts: Int, - testTimeout: Int + testTimeoutSeconds: Int ): TestRunnerService.ScheduleTestsResponse { val testMatrices = testLabController.submitTests( appApk = appApk ?: apkStore.getPlaceholderApk(), @@ -116,7 +116,7 @@ internal class TestRunnerServiceImpl internal constructor( cachedTestMatrixFilter = cachedTestMatrixFilter, testTargets = testTargets, flakyTestAttempts = flakyTestAttempts, - testTimeout = testTimeout + testTimeoutSeconds = testTimeoutSeconds ) return TestRunnerService.ScheduleTestsResponse.create( testMatrices