Skip to content

Commit 436b25e

Browse files
authored
Remove test worker for tests and use withTimeout (#3618)
Should fix test task crashes on timeout
1 parent 7671e91 commit 436b25e

File tree

5 files changed

+6
-121
lines changed

5 files changed

+6
-121
lines changed

ktor-test-dispatcher/darwin/src/TestDarwin.kt

Lines changed: 0 additions & 36 deletions
This file was deleted.

ktor-test-dispatcher/mingwX64/src/TestMingwX64.kt

Lines changed: 0 additions & 20 deletions
This file was deleted.

ktor-test-dispatcher/posix/src/.gitkeep

Whitespace-only changes.
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
/*
2+
* Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
15
package io.ktor.test.dispatcher
26

37
import kotlinx.coroutines.*
4-
import platform.posix.*
58
import kotlin.coroutines.*
69

710
/**
@@ -12,9 +15,7 @@ public actual fun testSuspend(
1215
timeoutMillis: Long,
1316
block: suspend CoroutineScope.() -> Unit
1417
) {
15-
executeInWorker(timeoutMillis) {
16-
runBlocking {
17-
block()
18-
}
18+
runBlocking(context) {
19+
withTimeout(timeoutMillis, block)
1920
}
2021
}

ktor-test-dispatcher/posix/src/TestWorker.kt

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)