Skip to content

Commit

Permalink
Change name and description of flag
Browse files Browse the repository at this point in the history
  • Loading branch information
elihart committed Apr 5, 2019
1 parent b5419b6 commit aa5b368
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 51 deletions.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ flank:
## Google cloud storage path to store the JUnit XML results from the last run.
# smart-flank-gcs-path: gs://tmp_flank/flank/test_app_ios.xml

## Whether the JUnit XML results should be uploaded for Smart Flank.
## This can be disabled to prevent new results from overriding previous results.
## Default: true
# smart-flank-upload-enabled: true
## Disables smart flank JUnit XML uploading. Useful for preventing timing data from being updated.
## Default: false
# smart-flank-disable-upload: false

## Disables sharding. Useful for parameterized tests.
# disable-sharding: false
Expand Down Expand Up @@ -279,10 +278,9 @@ flank:
## Google cloud storage path to store the JUnit XML results from the last run.
# smart-flank-gcs-path: gs://tmp_flank/flank/test_app_android.xml

## Whether the JUnit XML results should be uploaded for Smart Flank.
## This can be disabled to prevent new results from overriding previous results.
## Default: true
# smart-flank-upload-enabled: true
## Disables smart flank JUnit XML uploading. Useful for preventing timing data from being updated.
## Default: false
# smart-flank-disable-upload: false

## Disables sharding. Useful for parameterized tests.
# disable-sharding: false
Expand Down
2 changes: 1 addition & 1 deletion release_notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## next (unreleased)

- [#537](https://github.com/TestArmada/flank/pull/537) Add `smart-flank-upload-enabled` yml option to prevent new results from overriding previous results. ([elihart](https://github.com/elihart))
- [#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))

## v5.0.1

Expand Down
7 changes: 3 additions & 4 deletions test_runner/flank.ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ flank:
## Google cloud storage path to store the JUnit XML results from the last run.
# smart-flank-gcs-path: gs://tmp_flank/flank/test_app_ios.xml

## Whether the JUnit XML results should be uploaded for Smart Flank.
## This can be disabled to prevent new results from overriding previous results.
## Default: true
# smart-flank-upload-enabled: true
## Disables smart flank JUnit XML uploading. Useful for preventing timing data from being updated.
## Default: false
# smart-flank-disable-upload: false

## Disables sharding. Useful for parameterized tests.
# disable-sharding: false
Expand Down
7 changes: 3 additions & 4 deletions test_runner/flank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,9 @@ flank:
## Google cloud storage path to store the JUnit XML results from the last run.
# smart-flank-gcs-path: gs://tmp_flank/flank/test_app_android.xml

## Whether the JUnit XML results should be uploaded for Smart Flank.
## This can be disabled to prevent new results from overriding previous results.
## Default: true
# smart-flank-upload-enabled: true
## Disables smart flank JUnit XML uploading. Useful for preventing timing data from being updated.
## Default: false
# smart-flank-disable-upload: false

## Disables sharding. Useful for parameterized tests.
# disable-sharding: false
Expand Down
4 changes: 2 additions & 2 deletions test_runner/src/main/kotlin/ftl/args/AndroidArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class AndroidArgs(
override val shardTime = cli?.shardTime ?: flank.shardTime
override val repeatTests = cli?.repeatTests ?: flank.repeatTests
override val smartFlankGcsPath = flank.smartFlankGcsPath
override val smartFlankUploadEnabled = cli?.smartFlankUploadEnabled ?: flank.smartFlankUploadEnabled
override val smartFlankDisableUpload = cli?.smartFlankDisableUpload ?: flank.smartFlankDisableUpload
override val testTargetsAlwaysRun = cli?.testTargetsAlwaysRun ?: flank.testTargetsAlwaysRun
override val filesToDownload = cli?.filesToDownload ?: flank.filesToDownload
override val disableSharding = cli?.disableSharding ?: flank.disableSharding
Expand Down Expand Up @@ -170,7 +170,7 @@ ${devicesToString(devices)}
shard-time: $shardTime
repeat-tests: $repeatTests
smart-flank-gcs-path: $smartFlankGcsPath
smart-flank-upload-enabled: $smartFlankUploadEnabled
smart-flank-disable-upload: $smartFlankDisableUpload
files-to-download:
${listToString(filesToDownload)}
test-targets-always-run:
Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/args/IArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface IArgs {
val shardTime: Int
val repeatTests: Int
val smartFlankGcsPath: String
val smartFlankUploadEnabled: Boolean
val smartFlankDisableUpload: Boolean
val testTargetsAlwaysRun: List<String>
val filesToDownload: List<String>
val disableSharding: Boolean
Expand Down
4 changes: 2 additions & 2 deletions test_runner/src/main/kotlin/ftl/args/IosArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class IosArgs(
override val shardTime = cli?.shardTime ?: flank.shardTime
override val repeatTests = cli?.repeatTests ?: flank.repeatTests
override val smartFlankGcsPath = flank.smartFlankGcsPath
override val smartFlankUploadEnabled = cli?.smartFlankUploadEnabled ?: flank.smartFlankUploadEnabled
override val smartFlankDisableUpload = cli?.smartFlankDisableUpload ?: flank.smartFlankDisableUpload
override val testTargetsAlwaysRun = cli?.testTargetsAlwaysRun ?: flank.testTargetsAlwaysRun
override val filesToDownload = cli?.filesToDownload ?: flank.filesToDownload
override val disableSharding = cli?.disableSharding ?: flank.disableSharding
Expand Down Expand Up @@ -125,7 +125,7 @@ ${devicesToString(devices)}
shard-time: $shardTime
repeat-tests: $repeatTests
smart-flank-gcs-path: $smartFlankGcsPath
smart-flank-upload-enabled: $smartFlankUploadEnabled
smart-flank-disable-upload: $smartFlankDisableUpload
test-targets-always-run:
${listToString(testTargetsAlwaysRun)}
files-to-download:
Expand Down
6 changes: 3 additions & 3 deletions test_runner/src/main/kotlin/ftl/args/yml/FlankYml.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class FlankYmlParams(
@field:JsonProperty("smart-flank-gcs-path")
val smartFlankGcsPath: String = "",

@field:JsonProperty("smart-flank-upload-enabled")
val smartFlankUploadEnabled: Boolean = true,
@field:JsonProperty("smart-flank-disable-upload")
val smartFlankDisableUpload: Boolean = false,

@field:JsonProperty("disable-sharding")
val disableSharding: Boolean = false,
Expand All @@ -42,7 +42,7 @@ class FlankYmlParams(
) {
companion object : IYmlKeys {
override val keys = listOf(
"max-test-shards", "shard-time", "repeat-tests", "smart-flank-gcs-path", "smart-flank-upload-enabled",
"max-test-shards", "shard-time", "repeat-tests", "smart-flank-gcs-path", "smart-flank-disable-upload",
"disable-sharding", "test-targets-always-run", "files-to-download", "project", "local-result-dir"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ class AndroidRunCommand : Runnable {
var localResultDir: String? = null

@Option(
names = ["--smart-flank-upload-enabled"],
description = ["Whether the JUnit XML results should be uploaded to the Smart Flank cloud storage."]
names = ["--smart-flank-disable-upload"],
description = ["Disables smart flank JUnit XML uploading. Useful for preventing timing data from being updated."]
)
var smartFlankUploadEnabled: Boolean? = null
var smartFlankDisableUpload: Boolean? = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ class IosRunCommand : Runnable {
var localResultsDir: String? = null

@Option(
names = ["--smart-flank-upload-enabled"],
description = ["Whether the JUnit XML results should be uploaded to the Smart Flank cloud storage."]
names = ["--smart-flank-disable-upload"],
description = ["Disables smart flank JUnit XML uploading. Useful for preventing timing data from being updated."]
)
var smartFlankUploadEnabled: Boolean? = null
var smartFlankDisableUpload: Boolean? = null
}
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/gc/GcStorage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object GcStorage {
)

fun uploadJunitXml(testResult: JUnitTestResult, args: IArgs) {
if (args.smartFlankGcsPath.isEmpty() || !args.smartFlankUploadEnabled) return
if (args.smartFlankGcsPath.isEmpty() || !args.smartFlankDisableUpload) return

// bucket/path/to/object
val rawPath = args.smartFlankGcsPath.drop(GCS_PREFIX.length)
Expand Down
12 changes: 6 additions & 6 deletions test_runner/src/test/kotlin/ftl/args/AndroidArgsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ AndroidArgs
shard-time: 60
repeat-tests: 8
smart-flank-gcs-path:${' '}
smart-flank-upload-enabled: true
smart-flank-disable-upload: false
files-to-download:
- /sdcard/screenshots
- /sdcard/screenshots2
Expand Down Expand Up @@ -816,20 +816,20 @@ AndroidArgs
}

@Test
fun `cli smart-flank-upload-enabled`() {
fun `cli smart-flank-disable-upload`() {
val cli = AndroidRunCommand()
CommandLine(cli).parse("--smart-flank-upload-enabled=false")
CommandLine(cli).parse("--smart-flank-disable-upload=true")

val yaml = """
gcloud:
app: $appApk
test: $testApk
flank:
smart-flank-upload-enabled: true
smart-flank-disable-upload: false
"""
assertThat(AndroidArgs.load(yaml).smartFlankUploadEnabled).isEqualTo(true)
assertThat(AndroidArgs.load(yaml).smartFlankDisableUpload).isEqualTo(false)

val androidArgs = AndroidArgs.load(yaml, cli)
assertThat(androidArgs.smartFlankUploadEnabled).isEqualTo(false)
assertThat(androidArgs.smartFlankDisableUpload).isEqualTo(true)
}
}
10 changes: 5 additions & 5 deletions test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ IosArgs
shard-time: 60
repeat-tests: 8
smart-flank-gcs-path:${' '}
smart-flank-upload-enabled: true
smart-flank-disable-upload: false
test-targets-always-run:
- a/testGrantPermissions
- a/testGrantPermissions2
Expand Down Expand Up @@ -636,19 +636,19 @@ IosArgs
}

@Test
fun `cli smart-flank-upload-enabled`() {
fun `cli smart-flank-disable-upload`() {
val cli = IosRunCommand()
CommandLine(cli).parse("--smart-flank-upload-enabled=false")
CommandLine(cli).parse("--smart-flank-disable-upload=true")

val yaml = """
gcloud:
test: $testPath
xctestrun-file: $testPath
"""
assertThat(IosArgs.load(yaml).smartFlankUploadEnabled).isEqualTo(true)
assertThat(IosArgs.load(yaml).smartFlankDisableUpload).isEqualTo(false)

val androidArgs = IosArgs.load(yaml, cli)
assertThat(androidArgs.smartFlankUploadEnabled).isEqualTo(false)
assertThat(androidArgs.smartFlankDisableUpload).isEqualTo(true)
}

private fun getValidTestsSample() = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class AndroidRunCommandTest {
assertThat(cmd.flakyTestAttempts).isNull()
assertThat(cmd.disableSharding).isNull()
assertThat(cmd.localResultDir).isNull()
assertThat(cmd.smartFlankUploadEnabled).isNull()
assertThat(cmd.smartFlankDisableUpload).isNull()
}

@Test
Expand Down Expand Up @@ -323,10 +323,10 @@ class AndroidRunCommandTest {
}

@Test
fun `smartFlankUploadEnabled parse`() {
fun `smartFlankDisableUpload parse`() {
val cmd = AndroidRunCommand()
CommandLine(cmd).parse("--smart-flank-upload-enabled=false")
CommandLine(cmd).parse("--smart-flank-disable-upload=true")

assertThat(cmd.smartFlankUploadEnabled).isEqualTo(false)
assertThat(cmd.smartFlankDisableUpload).isEqualTo(true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class IosRunCommandTest {
assertThat(cmd.resultsDir).isNull()
assertThat(cmd.flakyTestAttempts).isNull()
assertThat(cmd.localResultsDir).isNull()
assertThat(cmd.smartFlankUploadEnabled).isNull()
assertThat(cmd.smartFlankDisableUpload).isNull()
}

@Test
Expand Down Expand Up @@ -258,10 +258,10 @@ class IosRunCommandTest {
}

@Test
fun `smart-flank-upload-enabled parse`() {
fun `smart-flank-disable-upload parse`() {
val cmd = IosRunCommand()
CommandLine(cmd).parse("--smart-flank-upload-enabled=false")
CommandLine(cmd).parse("--smart-flank-disable-upload=true")

assertThat(cmd.smartFlankUploadEnabled).isEqualTo(false)
assertThat(cmd.smartFlankDisableUpload).isEqualTo(true)
}
}

0 comments on commit aa5b368

Please sign in to comment.