Skip to content

Commit

Permalink
Added saving paths to file
Browse files Browse the repository at this point in the history
  • Loading branch information
adamfilipow92 authored and mergify-bot committed Mar 11, 2021
1 parent 2e64f0d commit d8e7137
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions test_runner/src/main/kotlin/ftl/run/platform/RunAndroidTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package ftl.run.platform

import com.google.testing.Testing
import com.google.testing.model.TestMatrix
import flank.common.join
import flank.common.logLn
import ftl.args.AndroidArgs
import ftl.args.isInstrumentationTest
import ftl.args.shardsFilePath
import ftl.config.FtlConstants
import ftl.gc.GcAndroidDevice
import ftl.gc.GcAndroidTestMatrix
import ftl.gc.GcStorage
Expand All @@ -29,6 +31,7 @@ import ftl.run.platform.common.beforeRunTests
import ftl.run.saveShardChunks
import ftl.shard.Chunk
import ftl.shard.testCases
import ftl.util.saveToFlankLinks
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
Expand Down Expand Up @@ -85,6 +88,13 @@ private fun String.createGcsPath(contextIndex: Int, runIndex: Int) =
else "$this/matrix_${contextIndex}_$runIndex/"

private fun List<AndroidTestContext>.dumpShards(config: AndroidArgs) = takeIf { config.isInstrumentationTest }?.apply {
saveToFlankLinks(
config.shardsFilePath,
FtlConstants.GCS_STORAGE_LINK + join(
config.resultsBucket,
config.resultsDir
)
)
if (config.testTargetsForShard.isEmpty())
filterIsInstance<InstrumentationTestContext>()
.asMatrixTestShards()
Expand Down
8 changes: 7 additions & 1 deletion test_runner/src/main/kotlin/ftl/run/platform/RunIosTests.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package ftl.run.platform

import flank.common.join
import flank.common.logLn
import ftl.args.IosArgs
import ftl.args.isXcTest
import ftl.args.shardsFilePath
import ftl.config.FtlConstants
import ftl.gc.GcIosMatrix
import ftl.gc.GcIosTestMatrix
import ftl.gc.GcStorage
Expand All @@ -20,6 +22,7 @@ import ftl.run.platform.common.beforeRunTests
import ftl.run.platform.ios.createIosTestContexts
import ftl.shard.testCases
import ftl.util.repeat
import ftl.util.saveToFlankLinks
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
Expand All @@ -42,7 +45,10 @@ internal suspend fun IosArgs.runIosTests(): TestResult =
val additionalIpasGcsFiles = uploadAdditionalIpas()

dumpShardsIfXcTest()

saveToFlankLinks(
shardsFilePath,
FtlConstants.GCS_STORAGE_LINK + join(resultsBucket, resultsDir)
)
val testShardChunks = xcTestRunData.flattenShardChunks()
logLn(beforeRunMessage(testShardChunks))

Expand Down
3 changes: 3 additions & 0 deletions test_runner/src/main/kotlin/ftl/util/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package ftl.util
import com.fasterxml.jackson.annotation.JsonProperty
import flank.common.logLn
import ftl.run.exception.FlankGeneralError
import java.io.File
import java.io.InputStream
import java.time.Instant
import java.time.ZoneOffset
Expand Down Expand Up @@ -114,3 +115,5 @@ fun <T> KMutableProperty<T?>.require() =
)

fun getGACPathOrEmpty(): String = System.getenv("GOOGLE_APPLICATION_CREDENTIALS").orEmpty()

fun saveToFlankLinks(vararg links: String) = File("flank-links.log").writeText(links.joinToString(System.lineSeparator()))

0 comments on commit d8e7137

Please sign in to comment.