Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Print args when iOS tests are not found #1395

Merged
merged 6 commits into from
Dec 16, 2020
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 @@ -3,7 +3,6 @@ package integration
import FlankCommand
import com.google.common.truth.Truth.assertThat
import org.junit.Assume.assumeFalse
import org.junit.Ignore
import run
import org.junit.Test

Expand All @@ -30,7 +29,6 @@ class AllTestFilteredIT {
}

@Test
@Ignore("Should be fixed in https://github.com/Flank/flank/issues/1388")
fun `filter all tests - ios`() {
assumeFalse(isWindows)
val name = "$name-ios"
Expand All @@ -43,7 +41,7 @@ class AllTestFilteredIT {
testSuite = name
)

assertExitCode(result, 0)
assertExitCode(result, 1)

val resOutput = result.output.removeUnicode()
assertThat(resOutput).containsMatch(findInCompare(name))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,5 @@ Found xctest: [0-9a-zA-Z\/_.-]*/test_runner/src/test/kotlin/ftl/fixtures/tmp/ios
isMacOS = true \(mac os x\)
nm -U "[0-9a-zA-Z\/_.-]*/test_runner/src/test/kotlin/ftl/fixtures/tmp/ios/EarlGreyExample/Debug-iphoneos/EarlGreyExampleSwift.app/PlugIns/EarlGreyExampleSwiftTests.xctest/EarlGreyExampleSwiftTests"
nm -gU "[0-9a-zA-Z\/_.-]*/test_runner/src/test/kotlin/ftl/fixtures/tmp/ios/EarlGreyExample/Debug-iphoneos/EarlGreyExampleSwift.app/PlugIns/EarlGreyExampleSwiftTests.xctest/EarlGreyExampleSwiftTests" | xargs -s 262144 xcrun swift-demangle
Saved 0 shards to ios_shards.json
Uploading ios_shards.json \.*
Uploading earlgrey_example.zip \*.
0 test / 0 shard

0 matrix ids created in \d{1,2}m \d{1,2}s
https://console.developers.google.com/storage/browser/test-lab-[a-zA-Z0-9_-]*/[.a-zA-Z0-9_-]*

Matrices webLink


CostReport
No cost. 0m

Uploading CostReport.txt \.*
MatrixResultsReport
0 / 0 \(NaN\%\)
Uploading MatrixResultsReport.txt \.*
FetchArtifacts


Matrices webLink
Empty shards. Cannot match any method to \[.*\]
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/args/ValidateCommonArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ fun IArgs.checkResultsDirUnique() {
}

fun IArgs.checkDisableSharding() {
if (disableSharding && maxTestShards > 0)
if (disableSharding && maxTestShards > 1)
logLn("WARNING: disable-sharding enabled with max-test-shards = $maxTestShards, Flank will ignore max-test-shard and disable sharding.")
}
6 changes: 4 additions & 2 deletions test_runner/src/main/kotlin/ftl/args/ValidateIosArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import ftl.args.yml.Type
import ftl.ios.IosCatalog
import ftl.ios.IosCatalog.getSupportedVersionId
import ftl.ios.xctest.common.mapToRegex
import ftl.log.logLn
import ftl.run.exception.FlankConfigurationError
import ftl.run.exception.FlankGeneralError
import ftl.run.exception.IncompatibleTestDimensionError

fun IosArgs.validate() = apply {
Expand Down Expand Up @@ -95,7 +97,7 @@ private fun IosArgs.assertXcTestRunData() {
.flatMap { it.values }
.flatten()

if (filteredMethods.isEmpty()) throw FlankConfigurationError(
if (filteredMethods.isEmpty()) throw FlankGeneralError(
"Empty shards. Cannot match any method to $testTargets"
)

Expand All @@ -110,7 +112,7 @@ private fun IosArgs.assertXcTestRunData() {
}
}

println("WARNING: cannot match test_targets: $notMatched")
logLn("WARNING: cannot match test_targets: $notMatched")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ftl.args.validate
import ftl.cli.firebase.test.CommonRunCommand
import ftl.config.FtlConstants
import ftl.config.emptyAndroidConfig
import ftl.log.logLn
import ftl.mock.MockServer
import ftl.run.ANDROID_SHARD_FILE
import ftl.run.dumpShards
Expand Down Expand Up @@ -47,8 +48,10 @@ class AndroidRunCommand : CommonRunCommand(), Runnable {
MockServer.start()
}

AndroidArgs.load(Paths.get(configPath), cli = this).validate().run {
AndroidArgs.load(Paths.get(configPath), cli = this).apply {
setupLogLevel()
logLn(this)
}.validate().run {
runBlocking {
if (dumpShards) dumpShards()
else newTestRun()
Expand All @@ -62,3 +65,4 @@ class AndroidRunCommand : CommonRunCommand(), Runnable {
)
var dumpShards: Boolean = false
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ftl.args.validate
import ftl.cli.firebase.test.CommonRunCommand
import ftl.config.FtlConstants
import ftl.config.emptyIosConfig
import ftl.log.logLn
import ftl.mock.MockServer
import ftl.run.IOS_SHARD_FILE
import ftl.run.dumpShards
Expand Down Expand Up @@ -47,8 +48,10 @@ class IosRunCommand : CommonRunCommand(), Runnable {
MockServer.start()
}

IosArgs.load(Paths.get(configPath), cli = this).validate().run {
IosArgs.load(Paths.get(configPath), cli = this).apply {
setupLogLevel()
logLn(this)
}.validate().run {
if (dumpShards) dumpShards()
else runBlocking { newTestRun() }
}
Expand Down
1 change: 0 additions & 1 deletion test_runner/src/main/kotlin/ftl/run/NewTestRun.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import kotlinx.coroutines.withTimeoutOrNull

suspend fun IArgs.newTestRun() = withTimeoutOrNull(parsedTimeout) {
val args: IArgs = this@newTestRun
logLn(args)
val (matrixMap, testShardChunks, ignoredTests) =
cancelTestsOnTimeout(project) { runTests() }

Expand Down
6 changes: 3 additions & 3 deletions test_runner/src/main/kotlin/ftl/run/platform/RunIosTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ internal suspend fun IosArgs.runIosTests(): TestResult =
val otherGcsFiles = uploadOtherFiles()
val additionalIpasGcsFiles = uploadAdditionalIpas()

dumpShards()
if (disableResultsUpload.not())
GcStorage.upload(IOS_SHARD_FILE, resultsBucket, resultsDir)
dumpShards()
if (disableResultsUpload.not())
GcStorage.upload(IOS_SHARD_FILE, resultsBucket, resultsDir)

// Upload only after parsing shards to detect missing methods early.
val xcTestGcsPath = uploadIfNeeded(xctestrunZip.asFileReference()).gcs
Expand Down