Skip to content

Commit

Permalink
fix: Fix output of calculateShards() when all tests are filtered out (#…
Browse files Browse the repository at this point in the history
…2129)

When all tests were filtered out, it would throw an error `Invalid shard time`.

## Test Plan
> How do we know the code works?
Create a test apk with one test class with an annotation, and `@Ignored`. 
Filter the tests using that annotation.

Console should print out `No tests for ...` instead of crashing with `Invalid shard time`.

## Checklist
Couldn't find existing tests for this class.
  • Loading branch information
doodla authored Aug 11, 2021
1 parent a866375 commit 517da98
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test_runner/src/main/kotlin/ftl/args/ArgsHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ object ArgsHelper {
) // Avoid unnecessary computing if we already know there aren't tests to run.
}
val (ignoredTests, testsToExecute) = filteredTests.partition { it.ignored }

if (testsToExecute.isEmpty()) {
return CalculateShardsResult(listOf(), ignoredTests.map { it.testName })
}

val shards = if (args.disableSharding) {
listOf(
Chunk(
Expand Down

0 comments on commit 517da98

Please sign in to comment.