From 7f76176da9e9777bc1afda74994f94de6f322c6e Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Thu, 16 May 2019 11:28:54 -0400 Subject: [PATCH 1/3] wip --- firebase_apis/test_api/pom.xml | 4 +-- .../services/testing/model/ApkManifest.java | 24 +++++++++++++ .../testing/model/TestSpecification.java | 36 ------------------- test_app/build.gradle | 4 +-- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../src/main/kotlin/ftl/json/SavedMatrix.kt | 4 +++ .../src/main/kotlin/ftl/util/StepOutcome.kt | 3 +- 7 files changed, 35 insertions(+), 42 deletions(-) diff --git a/firebase_apis/test_api/pom.xml b/firebase_apis/test_api/pom.xml index 68db8e9af2..7a5fe54fcf 100644 --- a/firebase_apis/test_api/pom.xml +++ b/firebase_apis/test_api/pom.xml @@ -8,8 +8,8 @@ com.google.apis google-api-services-testing - v1-rev20190305-1.25.0-SNAPSHOT - Cloud Testing API v1-rev20190305-1.25.0-SNAPSHOT + v1-rev20190430-1.25.0-SNAPSHOT + Cloud Testing API v1-rev20190430-1.25.0-SNAPSHOT jar 2011 diff --git a/firebase_apis/test_api/src/main/java/com/google/api/services/testing/model/ApkManifest.java b/firebase_apis/test_api/src/main/java/com/google/api/services/testing/model/ApkManifest.java index 5b09f0d4d0..119787c9f9 100644 --- a/firebase_apis/test_api/src/main/java/com/google/api/services/testing/model/ApkManifest.java +++ b/firebase_apis/test_api/src/main/java/com/google/api/services/testing/model/ApkManifest.java @@ -64,6 +64,13 @@ public final class ApkManifest extends com.google.api.client.json.GenericJson { @com.google.api.client.util.Key private java.lang.String packageName; + /** + * Specifies the API Level on which the application is designed to run. + * The value may be {@code null}. + */ + @com.google.api.client.util.Key + private java.lang.Integer targetSdkVersion; + /** * User-readable name for the application. * @return value or {@code null} for none @@ -147,6 +154,23 @@ public ApkManifest setPackageName(java.lang.String packageName) { return this; } + /** + * Specifies the API Level on which the application is designed to run. + * @return value or {@code null} for none + */ + public java.lang.Integer getTargetSdkVersion() { + return targetSdkVersion; + } + + /** + * Specifies the API Level on which the application is designed to run. + * @param targetSdkVersion targetSdkVersion or {@code null} for none + */ + public ApkManifest setTargetSdkVersion(java.lang.Integer targetSdkVersion) { + this.targetSdkVersion = targetSdkVersion; + return this; + } + @Override public ApkManifest set(String fieldName, Object value) { return (ApkManifest) super.set(fieldName, value); diff --git a/firebase_apis/test_api/src/main/java/com/google/api/services/testing/model/TestSpecification.java b/firebase_apis/test_api/src/main/java/com/google/api/services/testing/model/TestSpecification.java index c88e86e295..e68fc7401b 100644 --- a/firebase_apis/test_api/src/main/java/com/google/api/services/testing/model/TestSpecification.java +++ b/firebase_apis/test_api/src/main/java/com/google/api/services/testing/model/TestSpecification.java @@ -50,17 +50,6 @@ public final class TestSpecification extends com.google.api.client.json.GenericJ @com.google.api.client.util.Key private AndroidTestLoop androidTestLoop; - /** - * Enables automatic Google account login. If set, the service will automatically generate a - * Google test account and add it to the device, before executing the test. Note that test - * accounts might be reused. Many applications show their full set of functionalities when an - * account is present on the device. Logging into the device with these generated accounts allows - * testing more functionalities. Default is false. - * The value may be {@code null}. - */ - @com.google.api.client.util.Key - private java.lang.Boolean autoGoogleLogin; - /** * Disables performance metrics recording; may reduce test latency. * The value may be {@code null}. @@ -155,31 +144,6 @@ public TestSpecification setAndroidTestLoop(AndroidTestLoop androidTestLoop) { return this; } - /** - * Enables automatic Google account login. If set, the service will automatically generate a - * Google test account and add it to the device, before executing the test. Note that test - * accounts might be reused. Many applications show their full set of functionalities when an - * account is present on the device. Logging into the device with these generated accounts allows - * testing more functionalities. Default is false. - * @return value or {@code null} for none - */ - public java.lang.Boolean getAutoGoogleLogin() { - return autoGoogleLogin; - } - - /** - * Enables automatic Google account login. If set, the service will automatically generate a - * Google test account and add it to the device, before executing the test. Note that test - * accounts might be reused. Many applications show their full set of functionalities when an - * account is present on the device. Logging into the device with these generated accounts allows - * testing more functionalities. Default is false. - * @param autoGoogleLogin autoGoogleLogin or {@code null} for none - */ - public TestSpecification setAutoGoogleLogin(java.lang.Boolean autoGoogleLogin) { - this.autoGoogleLogin = autoGoogleLogin; - return this; - } - /** * Disables performance metrics recording; may reduce test latency. * @return value or {@code null} for none diff --git a/test_app/build.gradle b/test_app/build.gradle index ecb55b46e9..2f7b4cd4ef 100644 --- a/test_app/build.gradle +++ b/test_app/build.gradle @@ -1,14 +1,14 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.20' + ext.kotlin_version = '1.3.31' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.android.tools.build:gradle:3.5.0-beta01' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/test_runner/gradle/wrapper/gradle-wrapper.properties b/test_runner/gradle/wrapper/gradle-wrapper.properties index 51fb1c466d..ee69dd68d1 100644 --- a/test_runner/gradle/wrapper/gradle-wrapper.properties +++ b/test_runner/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/test_runner/src/main/kotlin/ftl/json/SavedMatrix.kt b/test_runner/src/main/kotlin/ftl/json/SavedMatrix.kt index 9e640f0511..0aafecc8b5 100644 --- a/test_runner/src/main/kotlin/ftl/json/SavedMatrix.kt +++ b/test_runner/src/main/kotlin/ftl/json/SavedMatrix.kt @@ -8,6 +8,7 @@ import ftl.gc.GcToolResults import ftl.util.Billing import ftl.util.MatrixState.FINISHED import ftl.util.StepOutcome.failure +import ftl.util.StepOutcome.flaky import ftl.util.StepOutcome.inconclusive import ftl.util.StepOutcome.skipped import ftl.util.StepOutcome.success @@ -99,6 +100,9 @@ class SavedMatrix(matrix: TestMatrix) { outcome = stepOutcome.summary + // Treat flaky outcome as a success + if (outcome == flaky) outcome = success + outcomeDetails = when (outcome) { failure -> stepOutcome.failureDetail.keysToString() success -> stepOutcome.successDetail.keysToString() diff --git a/test_runner/src/main/kotlin/ftl/util/StepOutcome.kt b/test_runner/src/main/kotlin/ftl/util/StepOutcome.kt index 3c2108d7f5..184c3702f2 100644 --- a/test_runner/src/main/kotlin/ftl/util/StepOutcome.kt +++ b/test_runner/src/main/kotlin/ftl/util/StepOutcome.kt @@ -3,9 +3,10 @@ package ftl.util // ToolResults API step outcome values object StepOutcome { // https://github.com/bootstraponline/gcloud_cli/blob/master/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/toolresults_v1beta3.json#L755 - const val success = "success" const val failure = "failure" + const val flaky = "flaky" const val inconclusive = "inconclusive" const val skipped = "skipped" + const val success = "success" const val unset = "unset" } From a24a46ad1f84439facb605e56e6907cd26f7b199 Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Thu, 16 May 2019 12:16:43 -0400 Subject: [PATCH 2/3] Fix androidTest not showing up in Android Studio --- .../com/example/test_app/ExampleInstrumentedTest.kt | 0 .../com/example/test_app/screenshot/EspressoScreenshot.kt | 0 .../com/example/test_app/screenshot/ScreenshotTestRule.kt | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename test_app/app/src/androidTest/{kotlin => java}/com/example/test_app/ExampleInstrumentedTest.kt (100%) rename test_app/app/src/androidTest/{kotlin => java}/com/example/test_app/screenshot/EspressoScreenshot.kt (100%) rename test_app/app/src/androidTest/{kotlin => java}/com/example/test_app/screenshot/ScreenshotTestRule.kt (100%) diff --git a/test_app/app/src/androidTest/kotlin/com/example/test_app/ExampleInstrumentedTest.kt b/test_app/app/src/androidTest/java/com/example/test_app/ExampleInstrumentedTest.kt similarity index 100% rename from test_app/app/src/androidTest/kotlin/com/example/test_app/ExampleInstrumentedTest.kt rename to test_app/app/src/androidTest/java/com/example/test_app/ExampleInstrumentedTest.kt diff --git a/test_app/app/src/androidTest/kotlin/com/example/test_app/screenshot/EspressoScreenshot.kt b/test_app/app/src/androidTest/java/com/example/test_app/screenshot/EspressoScreenshot.kt similarity index 100% rename from test_app/app/src/androidTest/kotlin/com/example/test_app/screenshot/EspressoScreenshot.kt rename to test_app/app/src/androidTest/java/com/example/test_app/screenshot/EspressoScreenshot.kt diff --git a/test_app/app/src/androidTest/kotlin/com/example/test_app/screenshot/ScreenshotTestRule.kt b/test_app/app/src/androidTest/java/com/example/test_app/screenshot/ScreenshotTestRule.kt similarity index 100% rename from test_app/app/src/androidTest/kotlin/com/example/test_app/screenshot/ScreenshotTestRule.kt rename to test_app/app/src/androidTest/java/com/example/test_app/screenshot/ScreenshotTestRule.kt From f9342aa49c36c01668113322349a2fbf2a3d6367 Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Thu, 16 May 2019 13:27:06 -0400 Subject: [PATCH 3/3] Use Dispatchers.IO --- test_runner/src/main/kotlin/ftl/run/AndroidTestRunner.kt | 6 +++--- test_runner/src/main/kotlin/ftl/run/IosTestRunner.kt | 2 +- test_runner/src/main/kotlin/ftl/run/TestRunner.kt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test_runner/src/main/kotlin/ftl/run/AndroidTestRunner.kt b/test_runner/src/main/kotlin/ftl/run/AndroidTestRunner.kt index 0346332ffd..6e29262316 100644 --- a/test_runner/src/main/kotlin/ftl/run/AndroidTestRunner.kt +++ b/test_runner/src/main/kotlin/ftl/run/AndroidTestRunner.kt @@ -41,7 +41,7 @@ object AndroidTestRunner { testShardChunks.forEach { testTargets -> // specify dispatcher to avoid inheriting main runBlocking context that runs in the main thread // https://kotlinlang.org/docs/reference/coroutines/coroutine-context-and-dispatchers.html - jobs += async(Dispatchers.Default) { + jobs += async(Dispatchers.IO) { GcAndroidTestMatrix.build( appApkGcsPath = apk.app ?: androidArgs.appApk, testApkGcsPath = apk.test, @@ -73,8 +73,8 @@ object AndroidTestRunner { val result = mutableListOf() appTestApks.forEach { apks -> - val appApkGcsPath = async(Dispatchers.Default) { GcStorage.upload(apks.app ?: args.appApk, gcsBucket, runGcsPath) } - val testApkGcsPath = async(Dispatchers.Default) { GcStorage.upload(apks.test, gcsBucket, runGcsPath) } + val appApkGcsPath = async(Dispatchers.IO) { GcStorage.upload(apks.app ?: args.appApk, gcsBucket, runGcsPath) } + val testApkGcsPath = async(Dispatchers.IO) { GcStorage.upload(apks.test, gcsBucket, runGcsPath) } result.add( AppTestPair( diff --git a/test_runner/src/main/kotlin/ftl/run/IosTestRunner.kt b/test_runner/src/main/kotlin/ftl/run/IosTestRunner.kt index 1a55c72f9e..b0e8bf3fe5 100644 --- a/test_runner/src/main/kotlin/ftl/run/IosTestRunner.kt +++ b/test_runner/src/main/kotlin/ftl/run/IosTestRunner.kt @@ -44,7 +44,7 @@ object IosTestRunner { println(beforeRunMessage(iosArgs, iosArgs.testShardChunks)) repeat(runCount) { iosArgs.testShardChunks.forEach { testTargets -> - jobs += async(Dispatchers.Default) { + jobs += async(Dispatchers.IO) { GcIosTestMatrix.build( iosDeviceList = iosDeviceList, testZipGcsPath = xcTestGcsPath, diff --git a/test_runner/src/main/kotlin/ftl/run/TestRunner.kt b/test_runner/src/main/kotlin/ftl/run/TestRunner.kt index aa42c59723..d62500ffae 100644 --- a/test_runner/src/main/kotlin/ftl/run/TestRunner.kt +++ b/test_runner/src/main/kotlin/ftl/run/TestRunner.kt @@ -90,7 +90,7 @@ object TestRunner { // Only refresh unfinished if (MatrixState.inProgress(matrix.value.state)) { matrixCount += 1 - jobs += async(Dispatchers.Default) { GcTestMatrix.refresh(matrix.key, args) } + jobs += async(Dispatchers.IO) { GcTestMatrix.refresh(matrix.key, args) } } }