Skip to content

Commit

Permalink
Add cli command and tests for preserve-original-path
Browse files Browse the repository at this point in the history
  • Loading branch information
tahirhajizada committed Oct 29, 2019
1 parent 1d7e0fe commit 8683736
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/args/AndroidArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class AndroidArgs(

private val androidFlank = androidFlankYml.flank
val additionalAppTestApks = cli?.additionalAppTestApks ?: androidFlank.additionalAppTestApks
val preserveOriginalPath = androidFlank.preserveOriginalPath
val preserveOriginalPath = cli?.preserveOriginalPath ?: androidFlank.preserveOriginalPath

init {
resultsBucket = createGcsBucket(project, cli?.resultsBucket ?: gcloud.resultsBucket)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,11 @@ class AndroidRunCommand : Runnable {
}

var additionalAppTestApks: MutableList<AppTestPair>? = null

@Option(
names = ["--preserve-original-path"],
description = ["Downloaded files preserves the original path of file. " +
"Required when file names are not unique."]
)
var preserveOriginalPath: Boolean? = null
}
18 changes: 18 additions & 0 deletions test_runner/src/test/kotlin/ftl/args/AndroidArgsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -918,4 +918,22 @@ AndroidArgs
assertThat(androidArgs.additionalAppTestApks).isEqualTo(
listOf(AppTestPair("a", "b")))
}

@Test
fun `cli preserve-original-path`() {
val cli = AndroidRunCommand()
CommandLine(cli).parseArgs("--preserve-original-path=true")

val yaml = """
gcloud:
app: $appApk
test: $testApk
flank:
preserve-original-path: false
"""
assertThat(AndroidArgs.load(yaml).preserveOriginalPath).isEqualTo(false)

val androidArgs = AndroidArgs.load(yaml, cli)
assertThat(androidArgs.preserveOriginalPath).isEqualTo(true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class AndroidRunCommandTest {
assertThat(cmd.smartFlankDisableUpload).isNull()
assertThat(cmd.smartFlankGcsPath).isNull()
assertThat(cmd.additionalAppTestApks).isNull()
assertThat(cmd.preserveOriginalPath).isNull()
}

@Test
Expand Down Expand Up @@ -352,6 +353,14 @@ class AndroidRunCommandTest {
assertThat(cmd.smartFlankGcsPath).isEqualTo("foo")
}

@Test
fun `preserveOriginalPath parse`() {
val cmd = AndroidRunCommand()
CommandLine(cmd).parseArgs("--preserve-original-path=true")

assertThat(cmd.preserveOriginalPath).isEqualTo(true)
}

@Test
fun `additionalAppTestApks parse`() {
val cmd = AndroidRunCommand()
Expand Down

0 comments on commit 8683736

Please sign in to comment.