Skip to content

Commit

Permalink
Change messages on fast fail and change function fixMaxTestShardsValu…
Browse files Browse the repository at this point in the history
…e name to convertToShardCount
  • Loading branch information
adamfilipow92 committed Jun 2, 2020
1 parent 50d6567 commit 4618476
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
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 @@ -78,7 +78,7 @@ class AndroidArgs(
val devices = cli?.device ?: androidGcloud.device

private val flank = flankYml.flank
override val maxTestShards = fixMaxTestShardsValue(cli?.maxTestShards ?: flank.maxTestShards)
override val maxTestShards = convertToShardCount(cli?.maxTestShards ?: flank.maxTestShards)
override val shardTime = cli?.shardTime ?: flank.shardTime
override val repeatTests = cli?.repeatTests ?: flank.repeatTests
override val smartFlankGcsPath = cli?.smartFlankGcsPath ?: flank.smartFlankGcsPath
Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/args/ArgsHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object ArgsHelper {
)

if (args.maxTestShards !in AVAILABLE_SHARD_COUNT_RANGE && args.maxTestShards != -1)
throw FlankFatalError("max-test-shards must be >= ${AVAILABLE_SHARD_COUNT_RANGE.first} and <= ${AVAILABLE_SHARD_COUNT_RANGE.last}, or -1. But current is ${args.maxTestShards}")
throw FlankFatalError("max-test-shards must be >= ${AVAILABLE_SHARD_COUNT_RANGE.first} and <= ${AVAILABLE_SHARD_COUNT_RANGE.last}. But current is ${args.maxTestShards}")

if (args.shardTime <= 0 && args.shardTime != -1) throw FlankFatalError("shard-time must be >= 1 or -1")
if (args.repeatTests < 1) throw FlankFatalError("num-test-runs must be >= 1")
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 @@ -51,7 +51,7 @@ interface IArgs {

fun useLocalResultDir() = localResultDir != FlankYmlParams.defaultLocalResultsDir

fun fixMaxTestShardsValue(inputValue: Int): Int = if (inputValue == -1) {
fun convertToShardCount(inputValue: Int): Int = if (inputValue == -1) {
AVAILABLE_SHARD_COUNT_RANGE.last
} else {
inputValue
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 @@ -56,7 +56,7 @@ class IosArgs(
val devices = cli?.device ?: iosGcloud.device

private val flank = flankYml.flank
override val maxTestShards = fixMaxTestShardsValue(cli?.maxTestShards ?: flank.maxTestShards)
override val maxTestShards = convertToShardCount(cli?.maxTestShards ?: flank.maxTestShards)
override val shardTime = cli?.shardTime ?: flank.shardTime
override val repeatTests = cli?.repeatTests ?: flank.repeatTests
override val smartFlankGcsPath = cli?.smartFlankGcsPath ?: flank.smartFlankGcsPath
Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/test/kotlin/ftl/args/ArgsHelperTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class ArgsHelperTest {
@Test
fun testInvalidTestShards() {
val maxTestShards = -2
exceptionRule.expectMessage("max-test-shards must be >= ${IArgs.AVAILABLE_SHARD_COUNT_RANGE.first} and <= ${IArgs.AVAILABLE_SHARD_COUNT_RANGE.last}, or -1. But current is $maxTestShards")
exceptionRule.expectMessage("max-test-shards must be >= ${IArgs.AVAILABLE_SHARD_COUNT_RANGE.first} and <= ${IArgs.AVAILABLE_SHARD_COUNT_RANGE.last}. But current is $maxTestShards")

val args = spyk(AndroidArgs.default())
every { args.maxTestShards } returns maxTestShards
Expand Down

0 comments on commit 4618476

Please sign in to comment.