Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add attempts to performance test
Browse files Browse the repository at this point in the history
jan-goral committed Dec 18, 2020

Verified

This commit was signed with the committer’s verified signature.
1 parent c9966de commit e0fbca5
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test_runner/src/test/kotlin/ftl/shard/ShardTest.kt
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ import org.junit.Test
import org.junit.runner.RunWith
import java.util.concurrent.TimeUnit
import kotlin.system.measureNanoTime
import kotlin.system.measureTimeMillis

@RunWith(FlankTestRunner::class)
class ShardTest {
@@ -102,13 +103,20 @@ class ShardTest {
copy(commonArgs = commonArgs.copy(maxTestShards = 4))
}

val nano = measureNanoTime {
createShardsByShardCount(testsToRun, JUnitTestResult(null), arg)
}
val maxAttempts = 5
val maxMs = 5000

var attempt = 0
var ms = Long.MAX_VALUE

val ms = TimeUnit.NANOSECONDS.toMillis(nano)
println("Shards calculated in $ms ms")
assertThat(ms).isLessThan(5000)
while (attempt < maxAttempts && ms >= maxMs) {
attempt++
ms = measureTimeMillis {
createShardsByShardCount(testsToRun, JUnitTestResult(null), arg)
}
println("Shards calculated in $ms ms, attempt: $attempt")
}
assertThat(ms).isLessThan(maxMs)
}

@Test(expected = FlankConfigurationError::class)

0 comments on commit e0fbca5

Please sign in to comment.