mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
Compare commits
2
Commits
43ee2d9f27
...
d171825b5e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d171825b5e | ||
|
|
6f997dceb9 |
@@ -189,6 +189,7 @@ tasks.withType<Test>().configureEach {
|
||||
testLogging {
|
||||
exceptionFormat = TestExceptionFormat.FULL
|
||||
}
|
||||
outputs.cacheIf { false }
|
||||
}
|
||||
|
||||
tasks.register<Test>("integrationTest") {
|
||||
|
||||
@@ -4,7 +4,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.cancelAndJoin
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Assert.fail
|
||||
|
||||
const val TEST_TIMEOUT_MS = 30_000L
|
||||
|
||||
@@ -18,5 +18,14 @@ fun awaitUntil(
|
||||
) {
|
||||
val deadline = System.nanoTime() + TEST_TIMEOUT_MS * 1_000_000
|
||||
while (!predicate() && System.nanoTime() < deadline) Thread.sleep(10)
|
||||
assertTrue("Timed out after ${TEST_TIMEOUT_MS}ms $message", predicate())
|
||||
if (predicate()) return
|
||||
// A wall-clock wait that expires means something stalled rather than ran slow: the suite
|
||||
// finishes in milliseconds per test. Print every thread's stack in the failure message so the
|
||||
// stall is diagnosable from the CI log, which shows exception messages but not the test XML.
|
||||
fail("Timed out after ${TEST_TIMEOUT_MS}ms $message\n\n${threadDump()}")
|
||||
}
|
||||
|
||||
private fun threadDump(): String =
|
||||
Thread.getAllStackTraces().entries.joinToString("\n\n") { (thread, frames) ->
|
||||
"${thread.name} [${thread.state}]\n" + frames.joinToString("\n") { " at $it" }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user