Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: Fix calculate shards test #1413

Merged
merged 1 commit into from
Dec 18, 2020
Merged
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
8 changes: 7 additions & 1 deletion test_runner/src/test/kotlin/ftl/shard/ShardTest.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -96,8 +98,12 @@ class ShardTest {
val testsToRun = mutableListOf<FlankTestMethod>()
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)
Expand Down