From 2070c2112922811955d206e41a33dda8f6042376 Mon Sep 17 00:00:00 2001 From: Pawel Pasterz Date: Fri, 18 Dec 2020 12:42:53 +0100 Subject: [PATCH] Fix calculate shards test --- test_runner/src/test/kotlin/ftl/shard/ShardTest.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test_runner/src/test/kotlin/ftl/shard/ShardTest.kt b/test_runner/src/test/kotlin/ftl/shard/ShardTest.kt index b57b671ed6..18769472f6 100644 --- a/test_runner/src/test/kotlin/ftl/shard/ShardTest.kt +++ b/test_runner/src/test/kotlin/ftl/shard/ShardTest.kt @@ -1,6 +1,7 @@ package ftl.shard import com.google.common.truth.Truth.assertThat +import ftl.args.AndroidArgs import ftl.args.IArgs import ftl.args.IosArgs import ftl.reports.xml.model.JUnitTestCase @@ -12,6 +13,7 @@ import ftl.util.FlankTestMethod import io.mockk.every import io.mockk.mockk import io.mockk.unmockkAll +import java.nio.file.Paths import org.junit.After import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue @@ -96,8 +98,12 @@ class ShardTest { val testsToRun = mutableListOf() repeat(1_000_000) { index -> testsToRun.add(FlankTestMethod("$index/$index")) } + val arg = AndroidArgs.loadOrDefault(Paths.get("just-be-here"), null).run { + copy(commonArgs = commonArgs.copy(maxTestShards = 4)) + } + val nano = measureNanoTime { - createShardsByShardCount(testsToRun, JUnitTestResult(null), mockArgs(4)) + createShardsByShardCount(testsToRun, JUnitTestResult(null), arg) } val ms = TimeUnit.NANOSECONDS.toMillis(nano)