mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
[k8s] IJPL-66800 bring reload content action back
GitOrigin-RevId: 3325f22952a888b2d1c8f6d115372460cf564eae
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3514240a43
commit
4f53c895d6
@@ -9,12 +9,14 @@ import kotlinx.coroutines.withTimeout
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import kotlin.time.Duration
|
||||
|
||||
private val DELAY_INTERVAL: Long = 50
|
||||
|
||||
@TestOnly
|
||||
suspend fun waitUntil(message: String? = null, timeout: Duration = DEFAULT_TEST_TIMEOUT, condition: suspend CoroutineScope.() -> Boolean) {
|
||||
try {
|
||||
withTimeout(timeout) {
|
||||
while (!condition()) {
|
||||
delay(50)
|
||||
delay(DELAY_INTERVAL)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,4 +29,34 @@ suspend fun waitUntil(message: String? = null, timeout: Duration = DEFAULT_TEST_
|
||||
throw AssertionError(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
suspend fun waitUntilAssertSucceeds(message: String? = null, timeout: Duration = DEFAULT_TEST_TIMEOUT, block: suspend CoroutineScope.() -> Unit) {
|
||||
var storedFailure: AssertionError? = null
|
||||
|
||||
try {
|
||||
withTimeout(timeout) {
|
||||
while (true) {
|
||||
try {
|
||||
block()
|
||||
break
|
||||
}
|
||||
catch (e: AssertionError) {
|
||||
storedFailure = e
|
||||
}
|
||||
delay(DELAY_INTERVAL)
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e: TimeoutCancellationException) {
|
||||
println(dumpCoroutines())
|
||||
if (message != null) {
|
||||
throw AssertionError(message, storedFailure ?: e)
|
||||
}
|
||||
else {
|
||||
throw AssertionError(storedFailure ?: e)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user