Skip to content

Commit 3b2a2ba

Browse files
Add --local-result-dir (#523)
Use exit code 3 on fatal error instead of -1
1 parent b27238e commit 3b2a2ba

34 files changed

Lines changed: 221 additions & 83 deletions

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ flank:
151151

152152
## The billing enabled Google Cloud Platform project name to use
153153
# project: delta-essence-114723
154+
155+
## Local folder to store the test result. Folder is DELETED before each run to ensure only artifacts from the new run are saved.
156+
# local-result-dir: flank
154157
```
155158

156159
### Android example
@@ -285,6 +288,9 @@ flank:
285288

286289
## The billing enabled Google Cloud Platform project name to use
287290
# project: delta-essence-114723
291+
292+
## Local folder to store the test result. Folder is DELETED before each run to ensure only artifacts from the new run are saved.
293+
# local-result-dir: flank
288294
```
289295

290296
### Android code coverage

release_notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [#514](https://github.com/TestArmada/flank/pull/514) Rename `testShards` to `maxTestShards` ([miguelslemos](https://github.com/miguelslemos))
66
- [#518](https://github.com/TestArmada/flank/pull/518) Add deprecation warnings when old key names are used. `flank android doctor --fix` will auto fix the YAML file. ([bootstraponline](https://github.com/bootstraponline))
77
- [#519](https://github.com/TestArmada/flank/pull/519) Rename `maxTestShards` to `max-test-shards`, `shardTime` to `shard-time`, `repeatTests` to `repeat-tests`, `smartFlankGcsPath` to `smart-flank-gcs-path`, `disableSharding` to `disable-sharding`. Moved `project` from `gcloud` to `flank` ([bootstraponline](https://github.com/bootstraponline))
8+
- [#523](https://github.com/TestArmada/flank/pull/523) Add `--local-result-dir` to make it easy to find the test result at a fixed path. ([bootstraponline](https://github.com/bootstraponline))
89

910
## v4.4.0
1011

test_runner/flank.ios.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ flank:
102102

103103
## The billing enabled Google Cloud Platform project name to use
104104
# project: delta-essence-114723
105+
106+
## Local folder to store the test result. Folder is DELETED before each run to ensure only artifacts from the new run are saved.
107+
# local-result-dir: flank

test_runner/flank.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,7 @@ flank:
121121

122122
## The billing enabled Google Cloud Platform project name to use
123123
# project: delta-essence-114723
124+
125+
## Local folder to store the test result. Folder is DELETED before each run to ensure only artifacts from the new run are saved.
126+
# local-result-dir: flank
127+

test_runner/src/main/kotlin/ftl/args/AndroidArgs.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import ftl.args.ArgsToString.devicesToString
1919
import ftl.args.ArgsToString.listToString
2020
import ftl.args.ArgsToString.mapToString
2121
import ftl.args.yml.AndroidGcloudYml
22+
import ftl.args.yml.AndroidGcloudYmlParams
2223
import ftl.args.yml.FlankYml
2324
import ftl.args.yml.GcloudYml
2425
import ftl.args.yml.YamlDeprecated
@@ -72,6 +73,7 @@ class AndroidArgs(
7273
override val filesToDownload = cli?.filesToDownload ?: flank.filesToDownload
7374
override val disableSharding = cli?.disableSharding ?: flank.disableSharding
7475
override val project = cli?.project ?: flank.project
76+
override val localResultDir = cli?.localResultDir ?: flank.localResultDir
7577

7678
// computed properties not specified in yaml
7779
override val testShardChunks: List<List<String>> by lazy {
@@ -173,6 +175,7 @@ ${listToString(filesToDownload)}
173175
${listToString(testTargetsAlwaysRun)}
174176
disable-sharding: $disableSharding
175177
project: $project
178+
local-result-dir: $localResultDir
176179
""".trimIndent()
177180
}
178181

@@ -199,5 +202,9 @@ ${listToString(testTargetsAlwaysRun)}
199202
cli
200203
)
201204
}
205+
206+
fun default(): AndroidArgs {
207+
return AndroidArgs(GcloudYml(), AndroidGcloudYml(AndroidGcloudYmlParams(app = ".", test = ".")), FlankYml(), "", AndroidRunCommand())
208+
}
202209
}
203210
}

test_runner/src/main/kotlin/ftl/args/IArgs.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ interface IArgs {
2222
val testTargetsAlwaysRun: List<String>
2323
val filesToDownload: List<String>
2424
val disableSharding: Boolean
25+
val localResultDir: String?
2526

2627
// computed property
2728
val testShardChunks: List<List<String>>

test_runner/src/main/kotlin/ftl/args/IosArgs.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class IosArgs(
5656
override val filesToDownload = cli?.filesToDownload ?: flank.filesToDownload
5757
override val disableSharding = cli?.disableSharding ?: flank.disableSharding
5858
override val project = cli?.project ?: flank.project
59+
override val localResultDir = cli?.localResultsDir ?: flank.localResultDir
5960

6061
private val iosFlank = iosFlankYml.flank
6162
val testTargets = cli?.testTargets ?: iosFlank.testTargets
@@ -132,6 +133,7 @@ ${listToString(filesToDownload)}
132133
${listToString(testTargets)}
133134
disable-sharding: $disableSharding
134135
project: $project
136+
local-result-dir: $localResultDir
135137
""".trimIndent()
136138
}
137139

test_runner/src/main/kotlin/ftl/args/yml/AndroidGcloudYml.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class AndroidGcloudYmlParams(
5252

5353
@JsonIgnoreProperties(ignoreUnknown = true)
5454
class AndroidGcloudYml(
55-
val gcloud: AndroidGcloudYmlParams
55+
val gcloud: AndroidGcloudYmlParams = AndroidGcloudYmlParams()
5656

5757
) {
5858
companion object : IYmlMap {

test_runner/src/main/kotlin/ftl/args/yml/FlankYml.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,18 @@ class FlankYmlParams(
3232
@field:JsonProperty("files-to-download")
3333
val filesToDownload: List<String> = emptyList(),
3434

35-
val project: String = ArgsHelper.getDefaultProjectId() ?: ""
35+
val project: String = ArgsHelper.getDefaultProjectId() ?: "",
36+
37+
@field:JsonProperty("local-result-dir")
38+
val localResultDir: String = defaultLocalResultDir
3639
) {
3740
companion object : IYmlKeys {
3841
override val keys = listOf(
3942
"max-test-shards", "shard-time", "repeat-tests", "smart-flank-gcs-path", "disable-sharding",
40-
"test-targets-always-run", "files-to-download", "project"
43+
"test-targets-always-run", "files-to-download", "project", "local-result-dir"
4144
)
45+
46+
const val defaultLocalResultDir = "results"
4247
}
4348

4449
init {

test_runner/src/main/kotlin/ftl/cli/firebase/CancelCommand.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package ftl.cli.firebase
22

3+
import ftl.args.AndroidArgs
34
import ftl.run.TestRunner
45
import picocli.CommandLine
56

@@ -18,7 +19,7 @@ Reads in the matrix_ids.json file. Cancels any incomplete matrices.
1819
)
1920
class CancelCommand : Runnable {
2021
override fun run() {
21-
TestRunner.cancelLastRun()
22+
TestRunner.cancelLastRun(AndroidArgs.default())
2223
}
2324

2425
@CommandLine.Option(names = ["-h", "--help"], usageHelp = true, description = ["Prints this help message"])

0 commit comments

Comments
 (0)