Skip to content

Commit ca27667

Browse files
Rename --test-shards CLI flag to --max-test-shards (#541)
* Rename `--test-shards` CLI flag to `--max-test-shards` Add `--smart-flank-gcs-path` CLI flag * Update AndroidRunCommandTest.kt * Update IosRunCommand.kt * Update release_notes.md
1 parent 6a4932f commit ca27667

9 files changed

Lines changed: 280 additions & 199 deletions

File tree

release_notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## next (unreleased)
2-
-
2+
- [#541](https://github.com/TestArmada/flank/pull/541) Rename `--test-shards` CLI flag to `--max-test-shards`. Add `--smart-flank-gcs-path` CLI flag. ([bootstraponline](https://github.com/bootstraponline))
33

44
## v5.1.0
55
- [#537](https://github.com/TestArmada/flank/pull/537) Add `smart-flank-disable-upload` yml option to prevent new results from overriding previous results. ([elihart](https://github.com/elihart))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class AndroidArgs(
6868
override val maxTestShards = cli?.maxTestShards ?: flank.maxTestShards
6969
override val shardTime = cli?.shardTime ?: flank.shardTime
7070
override val repeatTests = cli?.repeatTests ?: flank.repeatTests
71-
override val smartFlankGcsPath = flank.smartFlankGcsPath
71+
override val smartFlankGcsPath = cli?.smartFlankGcsPath ?: flank.smartFlankGcsPath
7272
override val smartFlankDisableUpload = cli?.smartFlankDisableUpload ?: flank.smartFlankDisableUpload
7373
override val testTargetsAlwaysRun = cli?.testTargetsAlwaysRun ?: flank.testTargetsAlwaysRun
7474
override val filesToDownload = cli?.filesToDownload ?: flank.filesToDownload

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class IosArgs(
5151
override val maxTestShards = cli?.maxTestShards ?: flank.maxTestShards
5252
override val shardTime = cli?.shardTime ?: flank.shardTime
5353
override val repeatTests = cli?.repeatTests ?: flank.repeatTests
54-
override val smartFlankGcsPath = flank.smartFlankGcsPath
54+
override val smartFlankGcsPath = cli?.smartFlankGcsPath ?: flank.smartFlankGcsPath
5555
override val smartFlankDisableUpload = cli?.smartFlankDisableUpload ?: flank.smartFlankDisableUpload
5656
override val testTargetsAlwaysRun = cli?.testTargetsAlwaysRun ?: flank.testTargetsAlwaysRun
5757
override val filesToDownload = cli?.filesToDownload ?: flank.filesToDownload

test_runner/src/main/kotlin/ftl/cli/firebase/test/android/AndroidRunCommand.kt

Lines changed: 93 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class AndroidRunCommand : Runnable {
3636
}
3737
}
3838

39+
// Flank specific
40+
3941
@Option(
4042
names = ["-c", "--config"],
4143
description = ["YAML config file path"]
@@ -49,6 +51,8 @@ class AndroidRunCommand : Runnable {
4951
)
5052
var usageHelpRequested: Boolean = false
5153

54+
// AndroidGcloudYml.kt
55+
5256
@Option(
5357
names = ["--app"],
5458
description = ["The path to the application binary file. " +
@@ -64,23 +68,25 @@ class AndroidRunCommand : Runnable {
6468
var test: String? = null
6569

6670
@Option(
67-
names = ["--test-targets"],
68-
split = ",",
69-
description = ["A list of one or more test target filters to apply " +
70-
"(default: run all test targets). Each target filter must be fully qualified with the package name, class name, " +
71-
"or test annotation desired. Any test filter supported by am instrument -e … is supported. " +
72-
"See https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner for more " +
73-
"information."]
71+
names = ["--auto-google-login"],
72+
description = ["Automatically log into the test device using a preconfigured " +
73+
"Google account before beginning the test. Enabled by default, use --no-auto-google-login to disable."]
7474
)
75-
var testTargets: List<String>? = null
75+
var autoGoogleLogin: Boolean? = null
76+
77+
@Option(
78+
names = ["--no-auto-google-login"],
79+
description = ["Google account not logged in. See --auto-google-login."]
80+
)
81+
var noAutoGoogleLogin: Boolean? = null
7682

7783
@Option(
7884
names = ["--use-orchestrator"],
7985
description = ["Whether each test runs in its own Instrumentation instance " +
80-
"with the Android Test Orchestrator (default: Orchestrator is used. To disable, use --no-use-orchestrator). " +
81-
"Orchestrator is only compatible with AndroidJUnitRunner v1.0 or higher. See " +
82-
"https://developer.android.com/training/testing/junit-runner.html#using-android-test-orchestrator for more " +
83-
"information about Android Test Orchestrator."]
86+
"with the Android Test Orchestrator (default: Orchestrator is used. To disable, use --no-use-orchestrator). " +
87+
"Orchestrator is only compatible with AndroidJUnitRunner v1.0 or higher. See " +
88+
"https://developer.android.com/training/testing/junit-runner.html#using-android-test-orchestrator for more " +
89+
"information about Android Test Orchestrator."]
8490
)
8591
var useOrchestrator: Boolean? = null
8692

@@ -91,22 +97,31 @@ class AndroidRunCommand : Runnable {
9197
var noUseOrchestrator: Boolean? = null
9298

9399
@Option(
94-
names = ["--auto-google-login"],
95-
description = ["Automatically log into the test device using a preconfigured " +
96-
"Google account before beginning the test. Enabled by default, use --no-auto-google-login to disable."]
100+
names = ["--environment-variables"],
101+
split = ",",
102+
description = ["A comma-separated, key=value map of environment variables " +
103+
"and their desired values. --environment-variables=coverage=true,coverageFile=/sdcard/coverage.ec " +
104+
"The environment variables are mirrored as extra options to the am instrument -e KEY1 VALUE1 … command and " +
105+
"passed to your test runner (typically AndroidJUnitRunner)"]
97106
)
98-
var autoGoogleLogin: Boolean? = null
107+
var environmentVariables: Map<String, String>? = null
99108

100109
@Option(
101-
names = ["--no-auto-google-login"],
102-
description = ["Google account not logged in. See --auto-google-login."]
110+
names = ["--directories-to-pull"],
111+
split = ",",
112+
description = ["A list of paths that will be copied from the device's " +
113+
"storage to the designated results bucket after the test is complete. These must be absolute paths under " +
114+
"/sdcard or /data/local/tmp (for example, --directories-to-pull /sdcard/tempDir1,/data/local/tmp/tempDir2). " +
115+
"Path names are restricted to the characters a-zA-Z0-9_-./+. The paths /sdcard and /data will be made available " +
116+
"and treated as implicit path substitutions. E.g. if /sdcard on a particular device does not map to external " +
117+
"storage, the system will replace it with the external storage path prefix for that device."]
103118
)
104-
var noAutoGoogleLogin: Boolean? = null
119+
var directoriesToPull: List<String>? = null
105120

106121
@Option(
107122
names = ["--performance-metrics"],
108123
description = ["Monitor and record performance metrics: CPU, memory, " +
109-
"network usage, and FPS (game-loop only). Enabled by default, use --no-performance-metrics to disable."]
124+
"network usage, and FPS (game-loop only). Enabled by default, use --no-performance-metrics to disable."]
110125
)
111126
var performanceMetrics: Boolean? = null
112127

@@ -117,26 +132,15 @@ class AndroidRunCommand : Runnable {
117132
var noPerformanceMetrics: Boolean? = null
118133

119134
@Option(
120-
names = ["--environment-variables"],
121-
split = ",",
122-
description = ["A comma-separated, key=value map of environment variables " +
123-
"and their desired values. --environment-variables=coverage=true,coverageFile=/sdcard/coverage.ec " +
124-
"The environment variables are mirrored as extra options to the am instrument -e KEY1 VALUE1 … command and " +
125-
"passed to your test runner (typically AndroidJUnitRunner)"]
126-
)
127-
var environmentVariables: Map<String, String>? = null
128-
129-
@Option(
130-
names = ["--directories-to-pull"],
135+
names = ["--test-targets"],
131136
split = ",",
132-
description = ["A list of paths that will be copied from the device's " +
133-
"storage to the designated results bucket after the test is complete. These must be absolute paths under " +
134-
"/sdcard or /data/local/tmp (for example, --directories-to-pull /sdcard/tempDir1,/data/local/tmp/tempDir2). " +
135-
"Path names are restricted to the characters a-zA-Z0-9_-./+. The paths /sdcard and /data will be made available " +
136-
"and treated as implicit path substitutions. E.g. if /sdcard on a particular device does not map to external " +
137-
"storage, the system will replace it with the external storage path prefix for that device."]
137+
description = ["A list of one or more test target filters to apply " +
138+
"(default: run all test targets). Each target filter must be fully qualified with the package name, class name, " +
139+
"or test annotation desired. Any test filter supported by am instrument -e … is supported. " +
140+
"See https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner for more " +
141+
"information."]
138142
)
139-
var directoriesToPull: List<String>? = null
143+
var testTargets: List<String>? = null
140144

141145
@Option(
142146
names = ["--device"],
@@ -162,6 +166,8 @@ class AndroidRunCommand : Runnable {
162166

163167
var device: MutableList<Device>? = null
164168

169+
// GcloudYml.kt
170+
165171
@Option(
166172
names = ["--results-bucket"],
167173
description = ["The name of a Google Cloud Storage bucket where raw test " +
@@ -171,6 +177,16 @@ class AndroidRunCommand : Runnable {
171177
)
172178
var resultsBucket: String? = null
173179

180+
@Option(
181+
names = ["--results-dir"],
182+
description = [
183+
"The name of a unique Google Cloud Storage object within the results bucket where raw test results will be " +
184+
"stored (default: a timestamp with a random suffix). Caution: if specified, this argument must be unique for " +
185+
"each test matrix you create, otherwise results from multiple test matrices will be overwritten or " +
186+
"intermingled."]
187+
)
188+
var resultsDir: String? = null
189+
174190
@Option(
175191
names = ["--record-video"],
176192
description = ["Enable video recording during the test. " +
@@ -187,9 +203,9 @@ class AndroidRunCommand : Runnable {
187203
@Option(
188204
names = ["--timeout"],
189205
description = ["The max time this test execution can run before it is cancelled " +
190-
"(default: 15m). It does not include any time necessary to prepare and clean up the target device. The maximum " +
191-
"possible testing time is 30m on physical devices and 60m on virtual devices. The TIMEOUT units can be h, m, " +
192-
"or s. If no unit is given, seconds are assumed. "]
206+
"(default: 15m). It does not include any time necessary to prepare and clean up the target device. The maximum " +
207+
"possible testing time is 30m on physical devices and 60m on virtual devices. The TIMEOUT units can be h, m, " +
208+
"or s. If no unit is given, seconds are assumed. "]
193209
)
194210
var timeout: String? = null
195211

@@ -199,24 +215,26 @@ class AndroidRunCommand : Runnable {
199215
)
200216
var async: Boolean? = null
201217

202-
@Option(
203-
names = ["--project"],
204-
description = ["The Google Cloud Platform project name to use for this invocation. " +
205-
"If omitted, then the project from the service account credential is used"]
206-
)
207-
var project: String? = null
208-
209218
@Option(
210219
names = ["--results-history-name"],
211220
description = ["The history name for your test results " +
212-
"(an arbitrary string label; default: the application's label from the APK manifest). All tests which use the " +
213-
"same history name will have their results grouped together in the Firebase console in a time-ordered test " +
214-
"history list."]
221+
"(an arbitrary string label; default: the application's label from the APK manifest). All tests which use the " +
222+
"same history name will have their results grouped together in the Firebase console in a time-ordered test " +
223+
"history list."]
215224
)
216225
var resultsHistoryName: String? = null
217226

218227
@Option(
219-
names = ["--test-shards"],
228+
names = ["--flaky-test-attempts"],
229+
description = ["The number of times a TestExecution should be re-attempted if one or more of its test cases " +
230+
"fail for any reason. The maximum number of reruns allowed is 10. Default is 0, which implies no reruns."]
231+
)
232+
var flakyTestAttempts: Int? = null
233+
234+
// FlankYml.kt
235+
236+
@Option(
237+
names = ["--max-test-shards"],
220238
description = ["The amount of matrices to split the tests across."]
221239
)
222240
var maxTestShards: Int? = null
@@ -233,6 +251,25 @@ class AndroidRunCommand : Runnable {
233251
)
234252
var repeatTests: Int? = null
235253

254+
@Option(
255+
names = ["--smart-flank-gcs-path"],
256+
split = ",",
257+
description = ["Google cloud storage path to save test timing data used by smart flank."]
258+
)
259+
var smartFlankGcsPath: String? = null
260+
261+
@Option(
262+
names = ["--smart-flank-disable-upload"],
263+
description = ["Disables smart flank JUnit XML uploading. Useful for preventing timing data from being updated."]
264+
)
265+
var smartFlankDisableUpload: Boolean? = null
266+
267+
@Option(
268+
names = ["--disable-sharding"],
269+
description = ["Disable sharding."]
270+
)
271+
var disableSharding: Boolean? = null
272+
236273
@Option(
237274
names = ["--test-targets-always-run"],
238275
split = ",",
@@ -252,37 +289,15 @@ class AndroidRunCommand : Runnable {
252289
var filesToDownload: List<String>? = null
253290

254291
@Option(
255-
names = ["--disable-sharding"],
256-
description = ["Disable sharding."]
257-
)
258-
var disableSharding: Boolean? = null
259-
260-
@Option(
261-
names = ["--results-dir"],
262-
description = [
263-
"The name of a unique Google Cloud Storage object within the results bucket where raw test results will be " +
264-
"stored (default: a timestamp with a random suffix). Caution: if specified, this argument must be unique for " +
265-
"each test matrix you create, otherwise results from multiple test matrices will be overwritten or " +
266-
"intermingled."]
267-
)
268-
var resultsDir: String? = null
269-
270-
@Option(
271-
names = ["--flaky-test-attempts"],
272-
description = ["The number of times a TestExecution should be re-attempted if one or more of its test cases " +
273-
"fail for any reason. The maximum number of reruns allowed is 10. Default is 0, which implies no reruns."]
292+
names = ["--project"],
293+
description = ["The Google Cloud Platform project name to use for this invocation. " +
294+
"If omitted, then the project from the service account credential is used"]
274295
)
275-
var flakyTestAttempts: Int? = null
296+
var project: String? = null
276297

277298
@Option(
278299
names = ["--local-result-dir"],
279300
description = ["Saves test result to this local folder. Deleted before each run."]
280301
)
281302
var localResultDir: String? = null
282-
283-
@Option(
284-
names = ["--smart-flank-disable-upload"],
285-
description = ["Disables smart flank JUnit XML uploading. Useful for preventing timing data from being updated."]
286-
)
287-
var smartFlankDisableUpload: Boolean? = null
288303
}

0 commit comments

Comments
 (0)