Skip to content

Commit f23c7b7

Browse files
authored
Fix overlapping results (#805)
1 parent a9127ea commit f23c7b7

13 files changed

Lines changed: 56 additions & 209 deletions

File tree

release_notes.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
## next (unreleased)
22

3-
- [#784](https://github.com/Flank/flank/pull/784) Add output-style option. ([jan-gogo](https://github.com/jan-gogo))
3+
- [#784](https://github.com/Flank/flank/pull/784) Add output-style option. ([jan-gogo](https://github.com/jan-gogo))
44
- [#779](https://github.com/Flank/flank/pull/779) Print retries & display additional info. ([jan-gogo](https://github.com/jan-gogo))
5-
- [#793](https://github.com/Flank/flank/issues/793) Better error message on file not found. ([adamfilipow92](https://github.com/adamfilipow92))
6-
- [#808](https://github.com/Flank/flank/issues/808) Fixed dry run crashes. ([piotradamczyk5](https://github.com/piotradamczyk5))
7-
- [#807](https://github.com/Flank/flank/issues/807) Fix Bugsnag being initialized during tests. ([piotradamczyk5](https://github.com/piotradamczyk5))
8-
-
5+
- [#793](https://github.com/Flank/flank/issues/793) Better error message on file not found. ([adamfilipow92](https://github.com/adamfilipow92))
6+
- [#808](https://github.com/Flank/flank/issues/808) Fixed dry run crashes. ([piotradamczyk5](https://github.com/piotradamczyk5))
7+
- [#807](https://github.com/Flank/flank/issues/807) Fix Bugsnag being initialized during tests. ([piotradamczyk5](https://github.com/piotradamczyk5))
8+
- [#805](https://github.com/Flank/flank/pull/805) Fix overlapping results. ([pawelpasterz](https://github.com/pawelpasterz))
99

1010
## v20.05.2
1111

12-
- [#781](https://github.com/Flank/flank/pull/781) Remove local exists check on cloud results-dir. Fixes crash when results-dir is set by the user. ([adamfilipow92](https://github.com/adamfilipow92))
12+
- [#781](https://github.com/Flank/flank/pull/781) Remove local exists check on cloud results-dir. Fixes crash when results-dir is set by the user. ([adamfilipow92](https://github.com/adamfilipow92))
1313
- [#656](https://github.com/Flank/flank/issues/656) Improve error message reporting. ([adamfilipow92](https://github.com/adamfilipow92))
1414
- [#783](https://github.com/Flank/flank/pull/783) Use legacy results for iOS by default. ([pawelpasterz](https://github.com/pawelpasterz))
1515

test_runner/docs/ascii/flank.jar_-android-run.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Configuration is read from flank.yml
144144
Keeps the full path of downloaded files. Required when file names are not unique.
145145

146146
*--output-style*=_<outputStyle>_::
147-
Output style of execution status. Maybe be one of [verbose, multi, single]For runs with only one test execution default value is 'verbose', in other cases'multi' is used as default. Output style 'multi' is not displayed correctly on consoleswhich not supports ansi codes, to avoid corrupted output use `single` or `verbose`.
147+
Output style of execution status. May be one of [verbose, multi, single]. For runs with only one test execution the default value is 'verbose', in other cases 'multi' is used as the default. The output style 'multi' is not displayed correctly on consoles which don't support ansi codes, to avoid corrupted output use `single` or `verbose`.
148148

149149
*--dump-shards*::
150150
Dumps the shards to android_shards.json for debugging

test_runner/docs/ascii/flank.jar_-firebase-test-android-run.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Configuration is read from flank.yml
156156
Keeps the full path of downloaded files. Required when file names are not unique.
157157

158158
*--output-style*=_<outputStyle>_::
159-
Output style of execution status. Maybe be one of [verbose, multi, single]For runs with only one test execution default value is 'verbose', in other cases'multi' is used as default. Output style 'multi' is not displayed correctly on consoleswhich not supports ansi codes, to avoid corrupted output use `single` or `verbose`.
159+
Output style of execution status. May be one of [verbose, multi, single]. For runs with only one test execution the default value is 'verbose', in other cases 'multi' is used as the default. The output style 'multi' is not displayed correctly on consoles which don't support ansi codes, to avoid corrupted output use `single` or `verbose`.
160160

161161
*--dump-shards*::
162162
Dumps the shards to android_shards.json for debugging

test_runner/docs/ascii/flank.jar_-firebase-test-ios-run.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Configuration is read from flank.yml
136136
Keeps the full path of downloaded files. Required when file names are not unique.
137137

138138
*--output-style*=_<outputStyle>_::
139-
Output style of execution status. Maybe be one of [verbose, multi, single]For runs with only one test execution default value is 'verbose', in other cases'multi' is used as default. Output style 'multi' is not displayed correctly on consoleswhich not supports ansi codes, to avoid corrupted output use `single` or `verbose`.
139+
Output style of execution status. May be one of [verbose, multi, single]. For runs with only one test execution the default value is 'verbose', in other cases 'multi' is used as the default. The output style 'multi' is not displayed correctly on consoles which don't support ansi codes, to avoid corrupted output use `single` or `verbose`.
140140

141141
*--dump-shards*::
142142
Dumps the shards to ios_shards.json for debugging

test_runner/docs/ascii/flank.jar_-ios-run.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Configuration is read from flank.yml
128128
Keeps the full path of downloaded files. Required when file names are not unique.
129129

130130
*--output-style*=_<outputStyle>_::
131-
Output style of execution status. Maybe be one of [verbose, multi, single]For runs with only one test execution default value is 'verbose', in other cases'multi' is used as default. Output style 'multi' is not displayed correctly on consoleswhich not supports ansi codes, to avoid corrupted output use `single` or `verbose`.
131+
Output style of execution status. May be one of [verbose, multi, single]. For runs with only one test execution the default value is 'verbose', in other cases 'multi' is used as the default. The output style 'multi' is not displayed correctly on consoles which don't support ansi codes, to avoid corrupted output use `single` or `verbose`.
132132

133133
*--dump-shards*::
134134
Dumps the shards to ios_shards.json for debugging

test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ object ReportManager {
4141
val objName = matrices.runPath // 2019-03-22_17-20-53.594000_ftrh
4242

4343
// shard location in path changes based on iOS or Android.
44-
val matchResult = Regex("/(shard_\\d+)(-rerun_\\d+)?/").find(xmlFile.toString())
44+
val matchResult = Regex("/.*(shard_\\d+)(-rerun_\\d+)?/").find(xmlFile.toString())
4545
val shardName = matchResult?.value?.removePrefix("/")?.removeSuffix("/") // shard_0 || shard_0-rerun_1
4646
val matrixPath = Paths.get(objName, shardName).toString() // 2019-03-22_17-20-53.594000_ftrh/shard_0
4747

test_runner/src/main/kotlin/ftl/run/common/FetchArtifacts.kt

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
package ftl.run.common
22

33
import com.google.cloud.storage.Storage
4-
import ftl.args.AndroidArgs
54
import ftl.args.IArgs
65
import ftl.config.FtlConstants
7-
import ftl.gc.GcStorage
86
import ftl.json.MatrixMap
7+
import ftl.gc.GcStorage
98
import ftl.util.Artifacts
109
import ftl.util.MatrixState
11-
import ftl.util.ObjPath
10+
import java.nio.file.Path
11+
import java.nio.file.Paths
1212
import kotlinx.coroutines.Dispatchers
1313
import kotlinx.coroutines.coroutineScope
1414
import kotlinx.coroutines.joinAll
1515
import kotlinx.coroutines.launch
16-
import java.nio.file.Path
17-
import java.nio.file.Paths
1816

1917
internal suspend fun fetchArtifacts(matrixMap: MatrixMap, args: IArgs) = coroutineScope {
2018
println("FetchArtifacts")
@@ -64,17 +62,13 @@ internal suspend fun fetchArtifacts(matrixMap: MatrixMap, args: IArgs) = corouti
6462

6563
internal fun getDownloadPath(args: IArgs, blobPath: String): Path {
6664
val localDir = args.localResultDir
67-
val p = if (args is AndroidArgs)
68-
ObjPath.parse(blobPath) else
69-
ObjPath.legacyParse(blobPath)
65+
val parsed = Paths.get(blobPath)
66+
val objName = if (args.useLocalResultDir()) "" else parsed.getName(0).toString()
67+
// for iOS it is shardName, remove this comment after FTL introduce server side sharding for iOS
68+
val matrixName = parsed.getName(1).toString()
69+
val deviceName = parsed.getName(2).toString()
70+
val filePathName = if (args.keepFilePath) parsed.parent.drop(3).joinToString("/") else ""
71+
val fileName = parsed.fileName.toString()
7072

71-
// Store downloaded artifacts at device root.
72-
return Paths.get(
73-
localDir,
74-
if (args.useLocalResultDir().not()) p.objName else "",
75-
p.shardName,
76-
p.deviceName,
77-
if (args.keepFilePath) p.filePathName else "",
78-
p.fileName
79-
)
73+
return Paths.get("$localDir/$objName/$matrixName/$deviceName/$filePathName/$fileName")
8074
}

test_runner/src/main/kotlin/ftl/run/platform/RunAndroidTests.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ internal suspend fun runAndroidTests(args: AndroidArgs): TestResult = coroutineS
3838
val history = GcToolResults.createToolResultsHistory(args)
3939
val otherGcsFiles = args.uploadOtherFiles(runGcsPath)
4040

41-
args.resolveApks().forEach { apks: ResolvedApks ->
41+
args.resolveApks().forEachIndexed { index: Int, apks: ResolvedApks ->
4242
val testShards = apks.test?.let { test ->
4343
AndroidTestShard.getTestShardChunks(args, test)
4444
}
@@ -47,7 +47,7 @@ internal suspend fun runAndroidTests(args: AndroidArgs): TestResult = coroutineS
4747
val shardsWithAtLeastOneTest = testShards.filterAtLeastOneTest()
4848
if (shardsWithAtLeastOneTest.isEmpty()) {
4949
// No tests to run, skipping the execution.
50-
return@forEach
50+
return@forEachIndexed
5151
}
5252
allTestShardChunks += shardsWithAtLeastOneTest
5353
}
@@ -67,7 +67,7 @@ internal suspend fun runAndroidTests(args: AndroidArgs): TestResult = coroutineS
6767
testMatrices += executeAndroidTestMatrix(runCount = args.repeatTests) {
6868
GcAndroidTestMatrix.build(
6969
androidTestConfig = androidTestConfig,
70-
runGcsPath = runGcsPath,
70+
runGcsPath = "$runGcsPath/matrix_$index/",
7171
additionalApkGcsPaths = uploadedApks.additionalApks,
7272
androidDeviceList = androidDeviceList,
7373
args = args,

test_runner/src/main/kotlin/ftl/util/ObjPath.kt

Lines changed: 0 additions & 55 deletions
This file was deleted.

test_runner/src/main/kotlin/ftl/util/Utils.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ fun uniqueObjectName(): String {
8484
bucketName.append(letter)
8585
}
8686

87-
bucketName.append("/")
88-
8987
return bucketName.toString()
9088
}
9189

0 commit comments

Comments
 (0)