From 517da989cfceb6815a181bffd640bdeaf3a71a79 Mon Sep 17 00:00:00 2001 From: Sridhar Vadlamani Date: Wed, 11 Aug 2021 04:04:34 -0700 Subject: [PATCH] fix: Fix output of calculateShards() when all tests are filtered out (#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. --- test_runner/src/main/kotlin/ftl/args/ArgsHelper.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test_runner/src/main/kotlin/ftl/args/ArgsHelper.kt b/test_runner/src/main/kotlin/ftl/args/ArgsHelper.kt index 1af3a6a703..3dc7c280cf 100644 --- a/test_runner/src/main/kotlin/ftl/args/ArgsHelper.kt +++ b/test_runner/src/main/kotlin/ftl/args/ArgsHelper.kt @@ -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(