diff --git a/test_runner/src/main/kotlin/ftl/args/ArgsHelper.kt b/test_runner/src/main/kotlin/ftl/args/ArgsHelper.kt index b3cd772304..180f40f49c 100644 --- a/test_runner/src/main/kotlin/ftl/args/ArgsHelper.kt +++ b/test_runner/src/main/kotlin/ftl/args/ArgsHelper.kt @@ -49,17 +49,18 @@ object ArgsHelper { throw FlankGeneralError("'$file' $name doesn't exist") } - private fun String.convertToWindowsPath() = this.replace("/", "\\").replaceFirst("~", System.getProperty("user.home")) + private fun String.convertToWindowsPath() = + this.replace("/", "\\").replaceFirst("~", System.getProperty("user.home")) private fun String.exist() = - if (startsWith(GCS_PREFIX)) GcStorage.exist(this) else File(this).exists() + if (startsWith(GCS_PREFIX)) GcStorage.exist(this) else File(this).exists() fun assertCommonProps(args: IArgs) { assertNotEmpty( args.project, "The project is not set. Define GOOGLE_CLOUD_PROJECT, set project in flank.yml\n" + - "or save service account credential to ${defaultCredentialPath}\n" + - " See https://github.com/GoogleCloudPlatform/google-cloud-java#specifying-a-project-id" + "or save service account credential to ${defaultCredentialPath}\n" + + " See https://github.com/GoogleCloudPlatform/google-cloud-java#specifying-a-project-id" ) if (args.maxTestShards !in AVAILABLE_PHYSICAL_SHARD_COUNT_RANGE && args.maxTestShards != -1) @@ -116,7 +117,12 @@ object ArgsHelper { GcStorage.storage.get(bucket, path) ?: throw FlankGeneralError("The file at '$uri' does not exist") } - fun validateTestMethods(testTargets: List, validTestMethods: Collection, from: String, skipValidation: Boolean = useMock) { + fun validateTestMethods( + testTargets: List, + validTestMethods: Collection, + from: String, + skipValidation: Boolean = useMock + ) { val missingMethods = testTargets - validTestMethods if (!skipValidation && missingMethods.isNotEmpty()) throw FlankConfigurationError("$from is missing methods: $missingMethods.\nValid methods:\n$validTestMethods") @@ -133,7 +139,7 @@ object ArgsHelper { // Due to permission issues, the user may not be able to list or create buckets. fun createGcsBucket(projectId: String, bucket: String): String { if (bucket.isBlank()) return GcToolResults.getDefaultBucket(projectId) - ?: throw FlankGeneralError("Failed to make bucket for $projectId") + ?: throw FlankGeneralError("Failed to make bucket for $projectId") if (useMock) return bucket // test lab supports using a special free storage bucket @@ -141,9 +147,9 @@ object ArgsHelper { if (bucket.startsWith("test-lab-")) return bucket val storage = StorageOptions.newBuilder() - .setCredentials(FtlConstants.credential) - .setProjectId(projectId) - .build().service + .setCredentials(FtlConstants.credential) + .setProjectId(projectId) + .build().service val bucketLabel = mapOf("flank" to "") val storageLocation = "us-central1" @@ -161,10 +167,10 @@ object ArgsHelper { try { storage.create( BucketInfo.newBuilder(bucket) - .setStorageClass(StorageClass.REGIONAL) - .setLocation(storageLocation) - .setLabels(bucketLabel) - .build() + .setStorageClass(StorageClass.REGIONAL) + .setLocation(storageLocation) + .setLabels(bucketLabel) + .build() ) } catch (e: Exception) { println("Warning: Failed to make bucket for $projectId\nCause: ${e.message}") @@ -264,9 +270,9 @@ object ArgsHelper { } fun String.normalizeFilePath(): String = - if (startsWith(GCS_PREFIX)) this - else try { - ArgsHelper.evaluateFilePath(this) - } catch (e: Throwable) { - this - } + if (startsWith(GCS_PREFIX)) this + else try { + ArgsHelper.evaluateFilePath(this) + } catch (e: Throwable) { + this + } diff --git a/test_runner/src/main/kotlin/ftl/ios/IosCatalog.kt b/test_runner/src/main/kotlin/ftl/ios/IosCatalog.kt index 4348d40171..75dd3cf261 100644 --- a/test_runner/src/main/kotlin/ftl/ios/IosCatalog.kt +++ b/test_runner/src/main/kotlin/ftl/ios/IosCatalog.kt @@ -26,7 +26,8 @@ object IosCatalog { fun softwareVersionsAsTable(projectId: String) = getVersionsList(projectId).asPrintableTable() - fun describeSoftwareVersion(projectId: String, versionId: String) = getVersionsList(projectId).getDescription(versionId) + fun describeSoftwareVersion(projectId: String, versionId: String) = + getVersionsList(projectId).getDescription(versionId) private fun getVersionsList(projectId: String) = iosDeviceCatalog(projectId).versions @@ -36,7 +37,8 @@ object IosCatalog { private fun getLocales(projectId: String) = iosDeviceCatalog(projectId).runtimeConfiguration.locales - fun supportedOrientationsAsTable(projectId: String) = iosDeviceCatalog(projectId).runtimeConfiguration.orientations.asPrintableTable() + fun supportedOrientationsAsTable(projectId: String) = + iosDeviceCatalog(projectId).runtimeConfiguration.orientations.asPrintableTable() fun supportedXcode(version: String, projectId: String) = xcodeVersions(projectId).contains(version) @@ -71,8 +73,7 @@ If this project has already been granted access, please make sure you are using on the Blaze or Flame billing plans, and that you have run gcloud config set billing/quota_project project -If you are still having issues, please email ftl-ios-feedback@google.com for support.""", - e +If you are still having issues, please email ftl-ios-feedback@google.com for support.""", e ) } } diff --git a/test_runner/src/main/kotlin/ftl/reports/api/PrepareForJUnitResult.kt b/test_runner/src/main/kotlin/ftl/reports/api/PrepareForJUnitResult.kt index 2e3c2d5694..7009628d21 100644 --- a/test_runner/src/main/kotlin/ftl/reports/api/PrepareForJUnitResult.kt +++ b/test_runner/src/main/kotlin/ftl/reports/api/PrepareForJUnitResult.kt @@ -39,13 +39,13 @@ private fun TestExecutionData.reduceTestCases() = copy( } ) -internal fun List.removeStackTraces(): List = map(TestExecutionData::removeStackTraces) +internal fun List.removeStackTraces(): List = + map(TestExecutionData::removeStackTraces) + private fun TestExecutionData.removeStackTraces() = copy( testCases = testCases.onEach { - if (it.flaky) { -it.stackTraces = emptyList() -} -} + if (it.flaky) it.stackTraces = emptyList() + } ) // For primary step return stepId instead of primaryStepId diff --git a/test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt b/test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt index 565d137868..7fe017d2fb 100644 --- a/test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt +++ b/test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt @@ -110,8 +110,8 @@ object ReportManager { matrices, testSuite?.apply { if (ignoredTestCases.isNotEmpty()) { - testsuites?.add(ignoredTestCases.toJunitTestsResults()) - } + testsuites?.add(ignoredTestCases.toJunitTestsResults()) + } }, printToStdout = false, args = args diff --git a/test_runner/src/test/kotlin/ftl/args/ArgsHelperTest.kt b/test_runner/src/test/kotlin/ftl/args/ArgsHelperTest.kt index c687fc2e8a..d47a59c31d 100644 --- a/test_runner/src/test/kotlin/ftl/args/ArgsHelperTest.kt +++ b/test_runner/src/test/kotlin/ftl/args/ArgsHelperTest.kt @@ -50,11 +50,11 @@ class ArgsHelperTest { val merged = mergeYmlKeys( mockk() { every { keys } returns listOf("devices", "test", "apk") -every { group } returns "gcloud" + every { group } returns "gcloud" }, mockk() { every { keys } returns listOf("xcode-version", "async", "client-details") - every { group } returns "gcloud" + every { group } returns "gcloud" } ) diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/networkprofiles/NetworkProfileDescribeTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/networkprofiles/NetworkProfileDescribeTest.kt index 8935a2ec98..7c6b39d5c9 100644 --- a/test_runner/src/test/kotlin/ftl/cli/firebase/test/networkprofiles/NetworkProfileDescribeTest.kt +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/networkprofiles/NetworkProfileDescribeTest.kt @@ -40,15 +40,15 @@ class NetworkProfileDescribeTest { fun `should print profile description if data exists`() { val configs = listOf( NetworkConfiguration().apply { - downRule = makeRule(0.5f) + downRule = makeRule(0.5f) upRule = makeRule(0.8f) id = "ANY" - }, + }, NetworkConfiguration().apply { - downRule = makeRule(0.1f) + downRule = makeRule(0.1f) upRule = makeRule(0.2f) id = "DIFFERENT" - } + } ) every { getNetworkConfiguration() } returns configs @@ -88,20 +88,20 @@ class NetworkProfileDescribeTest { fun `should print message if unable to find provided profile`() { val configs = listOf( NetworkConfiguration().apply { - downRule = makeRule(0.456f) + downRule = makeRule(0.456f) id = "ANY_1" upRule = makeRule(0.111f) - }, + }, NetworkConfiguration().apply { - downRule = makeRule(0.0976f) + downRule = makeRule(0.0976f) id = "ANY_2" upRule = makeRule(0.234f) - }, + }, NetworkConfiguration().apply { - downRule = makeRule(0.1f) + downRule = makeRule(0.1f) id = "ANY_3" upRule = makeRule(0.11233f) - } + } ) every { getNetworkConfiguration() } returns configs @@ -118,10 +118,10 @@ class NetworkProfileDescribeTest { fun `should handle possible null values`() { val configs = listOf( NetworkConfiguration().apply { - downRule = makeRule(0.456f) + downRule = makeRule(0.456f) id = "WITH_NULLS" upRule = TrafficRule().apply { packetLossRatio = 0.123f } - } + } ) every { getNetworkConfiguration() } returns configs diff --git a/test_runner/src/test/kotlin/ftl/environment/LocalesDescribeTest.kt b/test_runner/src/test/kotlin/ftl/environment/LocalesDescribeTest.kt index 4997a81c3e..067365b3b7 100644 --- a/test_runner/src/test/kotlin/ftl/environment/LocalesDescribeTest.kt +++ b/test_runner/src/test/kotlin/ftl/environment/LocalesDescribeTest.kt @@ -11,8 +11,8 @@ class LocalesDescribeTest { val locales = listOf( Locale().apply { id = "test" -name = "name_test" -tags = listOf("one", "second") + name = "name_test" + tags = listOf("one", "second") } ) @@ -32,7 +32,7 @@ tags = listOf("one", "second") val locales = listOf( Locale().apply { id = "test" -name = "name_test" + name = "name_test" } ) diff --git a/test_runner/src/test/kotlin/ftl/environment/android/AndroidModelDescriptionTest.kt b/test_runner/src/test/kotlin/ftl/environment/android/AndroidModelDescriptionTest.kt index 5009e2c7ce..3df2e9de23 100644 --- a/test_runner/src/test/kotlin/ftl/environment/android/AndroidModelDescriptionTest.kt +++ b/test_runner/src/test/kotlin/ftl/environment/android/AndroidModelDescriptionTest.kt @@ -12,19 +12,20 @@ class AndroidModelDescriptionTest { val models = listOf( AndroidModel().apply { id = "walleye" -codename = "walleye" -brand = "Google" -form = "PHYSICAL" -formFactor = "PHONE" -manufacturer = "Google" -name = "Pixel 2" -screenDensity = 420 -screenX = 1080 -screenY = 1920 -supportedAbis = listOf("arm64-v8a", "armeabi-v7a", "armeabi") -supportedVersionIds = listOf("26", "27", "28") -tags = listOf("default") -thumbnailUrl = "https://lh3.googleusercontent.com/j4urvb3lXTaFGZI6IzHmAjum2HQVID1OHPhDB7dOzRvXb2WscSX2RFwEEFFSYhajqRO5Yu0e6FYQ" + codename = "walleye" + brand = "Google" + form = "PHYSICAL" + formFactor = "PHONE" + manufacturer = "Google" + name = "Pixel 2" + screenDensity = 420 + screenX = 1080 + screenY = 1920 + supportedAbis = listOf("arm64-v8a", "armeabi-v7a", "armeabi") + supportedVersionIds = listOf("26", "27", "28") + tags = listOf("default") + thumbnailUrl = + "https://lh3.googleusercontent.com/j4urvb3lXTaFGZI6IzHmAjum2HQVID1OHPhDB7dOzRvXb2WscSX2RFwEEFFSYhajqRO5Yu0e6FYQ" } ) @@ -60,18 +61,19 @@ thumbnailUrl = "https://lh3.googleusercontent.com/j4urvb3lXTaFGZI6IzHmAjum2HQVID val models = listOf( AndroidModel().apply { id = "walleye" -codename = "walleye" -brand = "Google" -form = "PHYSICAL" -formFactor = "PHONE" -manufacturer = "Google" -name = "Pixel 2" -screenDensity = 420 -screenX = 1080 -screenY = 1920 -supportedAbis = listOf("arm64-v8a", "armeabi-v7a", "armeabi") -supportedVersionIds = listOf("26", "27", "28") -thumbnailUrl = "https://lh3.googleusercontent.com/j4urvb3lXTaFGZI6IzHmAjum2HQVID1OHPhDB7dOzRvXb2WscSX2RFwEEFFSYhajqRO5Yu0e6FYQ" + codename = "walleye" + brand = "Google" + form = "PHYSICAL" + formFactor = "PHONE" + manufacturer = "Google" + name = "Pixel 2" + screenDensity = 420 + screenX = 1080 + screenY = 1920 + supportedAbis = listOf("arm64-v8a", "armeabi-v7a", "armeabi") + supportedVersionIds = listOf("26", "27", "28") + thumbnailUrl = + "https://lh3.googleusercontent.com/j4urvb3lXTaFGZI6IzHmAjum2HQVID1OHPhDB7dOzRvXb2WscSX2RFwEEFFSYhajqRO5Yu0e6FYQ" } ) diff --git a/test_runner/src/test/kotlin/ftl/environment/android/AndroidSoftwareVersionDescriptionTest.kt b/test_runner/src/test/kotlin/ftl/environment/android/AndroidSoftwareVersionDescriptionTest.kt index 77a4a4ea6b..13237b6f45 100644 --- a/test_runner/src/test/kotlin/ftl/environment/android/AndroidSoftwareVersionDescriptionTest.kt +++ b/test_runner/src/test/kotlin/ftl/environment/android/AndroidSoftwareVersionDescriptionTest.kt @@ -12,15 +12,15 @@ class AndroidSoftwareVersionDescriptionTest { val versions = listOf( AndroidVersion().apply { id = "26" -apiLevel = 26 -codeName = "Oreo" -versionString = "8.0.x" -releaseDate = Date().apply { + apiLevel = 26 + codeName = "Oreo" + versionString = "8.0.x" + releaseDate = Date().apply { day = 21 -month = 8 -year = 2017 + month = 8 + year = 2017 } -tags = listOf("default") + tags = listOf("default") } ) @@ -45,13 +45,13 @@ tags = listOf("default") val versions = listOf( AndroidVersion().apply { id = "23" -apiLevel = 23 -codeName = "Marshmallow" -versionString = "6.0.x" -releaseDate = Date().apply { + apiLevel = 23 + codeName = "Marshmallow" + versionString = "6.0.x" + releaseDate = Date().apply { day = 5 -month = 10 -year = 2015 + month = 10 + year = 2015 } } ) diff --git a/test_runner/src/test/kotlin/ftl/environment/ios/IosModelDescriptionTest.kt b/test_runner/src/test/kotlin/ftl/environment/ios/IosModelDescriptionTest.kt index d2026186cf..db10ab27ce 100644 --- a/test_runner/src/test/kotlin/ftl/environment/ios/IosModelDescriptionTest.kt +++ b/test_runner/src/test/kotlin/ftl/environment/ios/IosModelDescriptionTest.kt @@ -12,14 +12,14 @@ class IosModelDescriptionTest { val models = listOf( IosModel().apply { deviceCapabilities = listOf("accelerometer", "arm64") -formFactor = "PHONE" -id = "iphone6s" -name = "iPhone 6s" -screenDensity = 326 -screenX = 750 -screenY = 1334 -supportedVersionIds = listOf("10.3", "11.2") -tags = listOf("deprecated=10.3", "deprecated=11.2") + formFactor = "PHONE" + id = "iphone6s" + name = "iPhone 6s" + screenDensity = 326 + screenX = 750 + screenY = 1334 + supportedVersionIds = listOf("10.3", "11.2") + tags = listOf("deprecated=10.3", "deprecated=11.2") } ) @@ -49,13 +49,13 @@ tags = listOf("deprecated=10.3", "deprecated=11.2") val models = listOf( IosModel().apply { deviceCapabilities = listOf("accelerometer", "arm64") -formFactor = "PHONE" -id = "iphone6s" -name = "iPhone 6s" -screenDensity = 326 -screenX = 750 -screenY = 1334 -supportedVersionIds = listOf("10.3", "11.2") + formFactor = "PHONE" + id = "iphone6s" + name = "iPhone 6s" + screenDensity = 326 + screenX = 750 + screenY = 1334 + supportedVersionIds = listOf("10.3", "11.2") } ) diff --git a/test_runner/src/test/kotlin/ftl/environment/ios/IosSoftwareVersionDescriptionTest.kt b/test_runner/src/test/kotlin/ftl/environment/ios/IosSoftwareVersionDescriptionTest.kt index 610167a74e..314144eea9 100644 --- a/test_runner/src/test/kotlin/ftl/environment/ios/IosSoftwareVersionDescriptionTest.kt +++ b/test_runner/src/test/kotlin/ftl/environment/ios/IosSoftwareVersionDescriptionTest.kt @@ -12,10 +12,10 @@ class IosSoftwareVersionDescriptionTest { val versions = listOf( IosVersion().apply { id = versionId -majorVersion = 10 -minorVersion = 3 -tags = listOf("default") -supportedXcodeVersionIds = listOf("10.2.1", "10.3", "11.0", "11.1", "11.2.1", "11.3.1") + majorVersion = 10 + minorVersion = 3 + tags = listOf("default") + supportedXcodeVersionIds = listOf("10.2.1", "10.3", "11.0", "11.1", "11.2.1", "11.3.1") } ) @@ -43,10 +43,10 @@ supportedXcodeVersionIds = listOf("10.2.1", "10.3", "11.0", "11.1", "11.2.1", "1 val versions = listOf( IosVersion().apply { id = versionId -majorVersion = 10 -minorVersion = 3 -tags = null -supportedXcodeVersionIds = listOf("10.2.1", "10.3", "11.0", "11.1", "11.2.1", "11.3.1") + majorVersion = 10 + minorVersion = 3 + tags = null + supportedXcodeVersionIds = listOf("10.2.1", "10.3", "11.0", "11.1", "11.2.1", "11.3.1") } ) diff --git a/test_runner/src/test/kotlin/ftl/gc/GcAndroidTestMatrixTest.kt b/test_runner/src/test/kotlin/ftl/gc/GcAndroidTestMatrixTest.kt index 74b365f852..e57ced850f 100644 --- a/test_runner/src/test/kotlin/ftl/gc/GcAndroidTestMatrixTest.kt +++ b/test_runner/src/test/kotlin/ftl/gc/GcAndroidTestMatrixTest.kt @@ -178,16 +178,16 @@ class GcAndroidTestMatrixTest { val testSetup = TestSetup().setEnvironmentVariables( androidArgs, AndroidTestConfig.Instrumentation( - appApkGcsPath = "", - testApkGcsPath = "", - testShards = emptyList(), - orchestratorOption = null, - numUniformShards = null, - disableSharding = false, - testRunnerClass = "", - keepTestTargetsEmpty = false, - environmentVariables = mapOf(Pair("coverageFile", "/sdcard/test.ec")) - ) + appApkGcsPath = "", + testApkGcsPath = "", + testShards = emptyList(), + orchestratorOption = null, + numUniformShards = null, + disableSharding = false, + testRunnerClass = "", + keepTestTargetsEmpty = false, + environmentVariables = mapOf(Pair("coverageFile", "/sdcard/test.ec")) + ) ) assertTrue(testSetup.environmentVariables.any { it.key == "coverageFile" && it.value == "/sdcard/test.ec" }) } @@ -208,16 +208,16 @@ class GcAndroidTestMatrixTest { val testSetup = TestSetup().setEnvironmentVariables( androidArgs, AndroidTestConfig.Instrumentation( - appApkGcsPath = "", - testApkGcsPath = "", - testShards = emptyList(), - orchestratorOption = null, - numUniformShards = null, - disableSharding = false, - testRunnerClass = "", - keepTestTargetsEmpty = false, - environmentVariables = mapOf(Pair("coverageFile", "/sdcard/test_module1.ec")) - ) + appApkGcsPath = "", + testApkGcsPath = "", + testShards = emptyList(), + orchestratorOption = null, + numUniformShards = null, + disableSharding = false, + testRunnerClass = "", + keepTestTargetsEmpty = false, + environmentVariables = mapOf(Pair("coverageFile", "/sdcard/test_module1.ec")) + ) ) assertTrue(testSetup.environmentVariables.any { it.key == "coverageFile" && it.value == "/sdcard/test_module1.ec" }) } @@ -238,16 +238,16 @@ class GcAndroidTestMatrixTest { val testSetup = TestSetup().setEnvironmentVariables( androidArgs, AndroidTestConfig.Instrumentation( - appApkGcsPath = "", - testApkGcsPath = "", - testShards = emptyList(), - orchestratorOption = null, - numUniformShards = null, - disableSharding = false, - testRunnerClass = "", - keepTestTargetsEmpty = false, - environmentVariables = mapOf(Pair("coverageFile", "/sdcard/test_module1.ec")) - ) + appApkGcsPath = "", + testApkGcsPath = "", + testShards = emptyList(), + orchestratorOption = null, + numUniformShards = null, + disableSharding = false, + testRunnerClass = "", + keepTestTargetsEmpty = false, + environmentVariables = mapOf(Pair("coverageFile", "/sdcard/test_module1.ec")) + ) ) assertEquals(1, testSetup.environmentVariables.count { it.key == "coverageFile" }) } diff --git a/test_runner/src/test/kotlin/ftl/reports/outcome/CreateMatrixOutcomeSummaryKtTest.kt b/test_runner/src/test/kotlin/ftl/reports/outcome/CreateMatrixOutcomeSummaryKtTest.kt index c482e69085..a39b7cb112 100644 --- a/test_runner/src/test/kotlin/ftl/reports/outcome/CreateMatrixOutcomeSummaryKtTest.kt +++ b/test_runner/src/test/kotlin/ftl/reports/outcome/CreateMatrixOutcomeSummaryKtTest.kt @@ -104,7 +104,7 @@ class CreateMatrixOutcomeSummaryKtTest { make { outcome = make { summary = "failure" -failureDetail = make { failedRoboscript = true } + failureDetail = make { failedRoboscript = true } } } )