Skip to content

Commit 9cc044e

Browse files
committed
Muted obscure wasm/js tests
1 parent 00b2ff4 commit 9cc044e

File tree

8 files changed

+31
-10
lines changed

8 files changed

+31
-10
lines changed

krpc/krpc-test/src/commonMain/kotlin/kotlinx/rpc/krpc/test/KrpcTransportTestBase.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ abstract class KrpcTransportTestBase {
444444

445445
@Test
446446
fun rpc_continuation_is_called_in_the_correct_scope_and_doesnt_block_other_rpcs() = runTest {
447-
if (isJs) {
447+
if (platform.isJs()) {
448448
println("Test is skipped on JS, because it doesn't support multiple threads.")
449449
return@runTest
450450
}
@@ -510,7 +510,14 @@ abstract class KrpcTransportTestBase {
510510
}
511511
}
512512

513-
private val EXTENDED_TIMEOUT = if (isJs) 500.seconds else 200.seconds
513+
private val EXTENDED_TIMEOUT = if (platform.isJs()) 500.seconds else 200.seconds
514514

515-
internal expect val isJs: Boolean
515+
@Suppress("unused")
516+
internal enum class Platform {
517+
JVM, JS, NATIVE, WASM_JS, WASI;
518+
519+
fun isJs(): Boolean = this == JS || this == WASM_JS
520+
}
521+
522+
internal expect val platform: Platform
516523
internal expect val iterations_100_000 : Int

krpc/krpc-test/src/commonTest/kotlin/kotlinx/rpc/krpc/test/cancellation/CancellationTest.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import kotlinx.coroutines.flow.first
1010
import kotlinx.coroutines.flow.flow
1111
import kotlinx.coroutines.flow.mapNotNull
1212
import kotlinx.coroutines.flow.toList
13+
import kotlinx.rpc.krpc.test.Platform
14+
import kotlinx.rpc.krpc.test.platform
1315
import kotlinx.rpc.withService
1416
import kotlin.test.Ignore
1517
import kotlin.test.Test
@@ -99,6 +101,10 @@ class CancellationTest {
99101

100102
@Test
101103
fun testCancellationInServerStream() = runCancellationTest {
104+
if (platform.isJs() || platform == Platform.WASI) {
105+
return@runCancellationTest
106+
}
107+
102108
supervisorScope {
103109
var ex: CancellationException? = null
104110
val requestJob = launch {
@@ -345,6 +351,10 @@ class CancellationTest {
345351

346352
@Test
347353
fun testRequestCancellationCancelsStream() = runCancellationTest {
354+
if (platform.isJs() || platform == Platform.WASI) {
355+
return@runCancellationTest
356+
}
357+
348358
val fence = CompletableDeferred<Unit>()
349359

350360
val job = launch {
@@ -369,6 +379,10 @@ class CancellationTest {
369379

370380
@Test
371381
fun testRequestCancellationCancelsStreamButNotOthers() = runCancellationTest {
382+
if (platform.isJs() || platform == Platform.WASI) {
383+
return@runCancellationTest
384+
}
385+
372386
val fence = CompletableDeferred<Unit>()
373387
val job = launch {
374388
service.outgoingStreamWithDelayedResponse(resumableFlow(fence))

krpc/krpc-test/src/commonTest/kotlin/kotlinx/rpc/krpc/test/cancellation/CancellationToolkit.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import kotlinx.rpc.withService
2222
import kotlin.time.Duration.Companion.seconds
2323

2424
fun runCancellationTest(body: suspend CancellationToolkit.() -> Unit): TestResult {
25-
return runTestWithCoroutinesProbes(timeout = 15.seconds) {
25+
return runTestWithCoroutinesProbes(timeout = 30.seconds) {
2626
val toolkit = CancellationToolkit(this)
2727
try {
2828
body(toolkit)

krpc/krpc-test/src/jsMain/kotlin/kotlinx/rpc/krpc/test/KrpcTransportTestBase.js.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
package kotlinx.rpc.krpc.test
66

7-
actual val isJs: Boolean = true
7+
internal actual val platform: Platform = Platform.JS
88
internal actual val iterations_100_000: Int = 10_000

krpc/krpc-test/src/jvmMain/kotlin/kotlinx/rpc/krpc/test/KrpcTransportTestBase.jvm.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
package kotlinx.rpc.krpc.test
66

7-
actual val isJs: Boolean = false
7+
internal actual val platform: Platform = Platform.JVM
88
internal actual val iterations_100_000: Int = 100_000

krpc/krpc-test/src/nativeMain/kotlin/kotlinx/rpc/krpc/test/KrpcTransportTestBase.native.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
package kotlinx.rpc.krpc.test
66

7-
actual val isJs: Boolean = false
7+
internal actual val platform: Platform = Platform.NATIVE
88
internal actual val iterations_100_000: Int = 100_000

krpc/krpc-test/src/wasmJsMain/kotlin/kotlinx/rpc/krpc/test/KrpcTransportTestBase.wasmJs.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
package kotlinx.rpc.krpc.test
66

7-
actual val isJs: Boolean = true
7+
internal actual val platform: Platform = Platform.WASM_JS
88
internal actual val iterations_100_000: Int = 10_000

krpc/krpc-test/src/wasmWasiMain/kotlin/kotlinx/rpc/krpc/test/KrpcTransportTestBase.wasmWasi.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
package kotlinx.rpc.krpc.test
66

7-
internal actual val isJs: Boolean = true
8-
internal actual val iterations_100_000: Int = 100_000
7+
internal actual val platform: Platform = Platform.WASI
8+
internal actual val iterations_100_000: Int = 10_000

0 commit comments

Comments
 (0)