Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --timeout #415

Merged
merged 1 commit into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -43,7 +43,7 @@ class AndroidArgs(
private val gcloud = gcloudYml.gcloud
override val resultsBucket: String
override val recordVideo = cli?.recordVideo ?: cli?.noRecordVideo?.not() ?: gcloud.recordVideo
override val testTimeout = gcloud.timeout
override val testTimeout = cli?.timeout ?: gcloud.timeout
override val async = gcloud.async
override val projectId = gcloud.project
override val resultsHistoryName = gcloud.resultsHistoryName
Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/args/IosArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class IosArgs(
private val gcloud = gcloudYml.gcloud
override val resultsBucket: String
override val recordVideo = cli?.recordVideo ?: cli?.noRecordVideo?.not() ?: gcloud.recordVideo
override val testTimeout = gcloud.timeout
override val testTimeout = cli?.timeout ?: gcloud.timeout
override val async = gcloud.async
override val projectId = gcloud.project
override val resultsHistoryName = gcloud.resultsHistoryName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,10 @@ class AndroidRunCommand : Runnable {

@Option(names = ["--no-record-video"], description = ["""Disable video recording during the test. See --record-video to enable."""])
var noRecordVideo: Boolean? = null

@Option(names = ["--timeout"], description = ["""The max time this test execution can run before it is cancelled
|(default: 15m). It does not include any time necessary to prepare and clean up the target device. The maximum
|possible testing time is 30m on physical devices and 60m on virtual devices. The TIMEOUT units can be h, m,
| or s. If no unit is given, seconds are assumed. """])
var timeout: String? = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,10 @@ class IosRunCommand : Runnable {

@Option(names = ["--no-record-video"], description = ["""Disable video recording during the test. See --record-video to enable."""])
var noRecordVideo: Boolean? = null

@Option(names = ["--timeout"], description = ["""The max time this test execution can run before it is cancelled
|(default: 15m). It does not include any time necessary to prepare and clean up the target device. The maximum
|possible testing time is 30m on physical devices and 60m on virtual devices. The TIMEOUT units can be h, m,
| or s. If no unit is given, seconds are assumed. """])
var timeout: String? = null
}
15 changes: 15 additions & 0 deletions test_runner/src/test/kotlin/ftl/args/AndroidArgsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -561,4 +561,19 @@ AndroidArgs
assertThat(AndroidArgs.load(yaml).recordVideo).isTrue()
assertThat(AndroidArgs.load(yaml, cli).recordVideo).isFalse()
}

@Test
fun cli_timeout() {
val cli = AndroidRunCommand()
CommandLine(cli).parse("--timeout=1m")

val yaml = """
gcloud:
app: $appApk
test: $testApk
timeout: 2m
"""
assertThat(AndroidArgs.load(yaml).testTimeout).isEqualTo("2m")
assertThat(AndroidArgs.load(yaml, cli).testTimeout).isEqualTo("1m")
}
}
15 changes: 15 additions & 0 deletions test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,19 @@ IosArgs
assertThat(IosArgs.load(yaml).recordVideo).isTrue()
assertThat(IosArgs.load(yaml, cli).recordVideo).isFalse()
}

@Test
fun cli_timeout() {
val cli = IosRunCommand()
CommandLine(cli).parse("--timeout=1m")

val yaml = """
gcloud:
test: $testPath
xctestrun-file: $xctestrunFile
timeout: 2m
"""
assertThat(IosArgs.load(yaml).testTimeout).isEqualTo("2m")
assertThat(IosArgs.load(yaml, cli).testTimeout).isEqualTo("1m")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class AndroidRunCommandTest {
assertThat(cmd.resultsBucket).isNull()
assertThat(cmd.recordVideo).isNull()
assertThat(cmd.noRecordVideo).isNull()
assertThat(cmd.timeout).isNull()
}

@Test
Expand Down Expand Up @@ -199,4 +200,12 @@ class AndroidRunCommandTest {

assertThat(cmd.noRecordVideo).isTrue()
}

@Test
fun timeout_parse() {
val cmd = AndroidRunCommand()
CommandLine(cmd).parse("--timeout=1m")

assertThat(cmd.timeout).isEqualTo("1m")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class IosRunCommandTest {
assertThat(cmd.resultsBucket).isNull()
assertThat(cmd.recordVideo).isNull()
assertThat(cmd.noRecordVideo).isNull()
assertThat(cmd.timeout).isNull()
}

@Test
Expand All @@ -85,4 +86,12 @@ class IosRunCommandTest {

assertThat(cmd.noRecordVideo).isTrue()
}

@Test
fun timeout_parse() {
val cmd = IosRunCommand()
CommandLine(cmd).parse("--timeout=1m")

assertThat(cmd.timeout).isEqualTo("1m")
}
}