Skip to content

Commit

Permalink
Do not run flaky tests on corresponding platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
serras committed Dec 17, 2024
1 parent 4700828 commit fda7cf8
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 7 deletions.
7 changes: 5 additions & 2 deletions arrow-libs/core/arrow-cache4k/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ kotlin {
jvm {
withJava()
}

js(IR) {
browser()
nodejs()
}

// @OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class) wasmJs {
// browser()
// nodejs()
// d8()
// }
// Native: https://kotlinlang.org/docs/native-target-support.html
// -- Tier 1 --
linuxX64()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import arrow.core.test.map2
import arrow.core.test.map3
import arrow.core.test.option
import arrow.core.test.testLaws
import arrow.platform.test.FlakyOnJs
import io.kotest.inspectors.forAll
import io.kotest.matchers.collections.shouldContainAll
import io.kotest.matchers.maps.shouldBeEmpty
Expand Down Expand Up @@ -714,7 +715,7 @@ class MapKTest {
}
}

@Test fun mapValuesOrAccumulateAccumulates() = runTest {
@Test @FlakyOnJs fun mapValuesOrAccumulateAccumulates() = runTest {
checkAll(
Arb.map(Arb.int(), Arb.int(), minSize = 1, maxSize = 30)
) { xs ->
Expand Down
12 changes: 12 additions & 0 deletions arrow-libs/core/arrow-platform/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ kotlin {
commonMain {
dependencies {
implementation(libs.kotlin.stdlib)
implementation(libs.kotlin.testAnnotations)
}
}
jvmMain {
dependencies {
implementation(libs.kotlin.testJUnit5)
}
}
jsMain {
dependencies {
implementation(libs.kotlin.test)
}
}
}
Expand All @@ -41,5 +52,6 @@ kotlin {
compilerOptions {
(project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) }
(project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) }
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package arrow.platform.test

public annotation class NonFlakyOnThisPlatform

public expect annotation class FlakyOnJvm()
public expect annotation class FlakyOnJs()
public expect annotation class FlakyOnNative()
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package arrow.platform.test

public actual typealias FlakyOnJvm = NonFlakyOnThisPlatform
public actual typealias FlakyOnJs = kotlin.test.Ignore
public actual typealias FlakyOnNative = NonFlakyOnThisPlatform
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package arrow.platform.test

public actual typealias FlakyOnJvm = org.junit.jupiter.api.Disabled
public actual typealias FlakyOnJs = NonFlakyOnThisPlatform
public actual typealias FlakyOnNative = NonFlakyOnThisPlatform
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package arrow.platform.test

public actual typealias FlakyOnJvm = NonFlakyOnThisPlatform
public actual typealias FlakyOnJs = NonFlakyOnThisPlatform
public actual typealias FlakyOnNative = kotlin.test.Ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package arrow.platform.test

public actual typealias FlakyOnJvm = NonFlakyOnThisPlatform
public actual typealias FlakyOnJs = NonFlakyOnThisPlatform
public actual typealias FlakyOnNative = NonFlakyOnThisPlatform
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import arrow.core.NonEmptyList
import arrow.core.left
import arrow.core.raise.either
import arrow.platform.stackSafeIteration
import arrow.platform.test.FlakyOnJs
import io.kotest.matchers.should
import io.kotest.matchers.shouldBe
import io.kotest.property.Arb
Expand Down Expand Up @@ -50,7 +51,7 @@ class ParMapTest {
).parMap { it.invoke() }
}

@Test fun parTraverseResultsInTheCorrectError() = runTestUsingDefaultDispatcher {
@Test @FlakyOnJs fun parTraverseResultsInTheCorrectError() = runTestUsingDefaultDispatcher {
checkAll(
Arb.int(min = 10, max = 20),
Arb.int(min = 1, max = 9),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package arrow.fx.coroutines

import arrow.core.Either
import arrow.core.identity
import arrow.platform.test.FlakyOnJvm
import io.kotest.matchers.should
import io.kotest.matchers.string.shouldStartWith
import kotlin.test.Test
Expand Down Expand Up @@ -67,7 +68,7 @@ class RaceNJvmTest {
fun race2ReturnsToOriginalContextOnFailureRight(): Unit =
race2ReturnsToOriginalContextOnFailure(true)

@Test
@Test @FlakyOnJvm
fun firstRacerOutOf2AlwaysWinsOnASingleThread(): Unit =
runBlocking(Dispatchers.Default) {
resourceScope {
Expand Down
6 changes: 5 additions & 1 deletion arrow-libs/optics/arrow-optics-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ kotlin {
browser()
nodejs()
}
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class) wasmJs()
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class) wasmJs {
browser()
nodejs()
d8()
}
androidTarget()
// Native: https://kotlinlang.org/docs/native-target-support.html
// -- Tier 1 --
Expand Down
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
animalSniffer = "1.7.2"
arrowGradleConfig = "0.12.0-rc.24"
arrowGradleConfig = "0.12.0-rc.25"
coroutines = "1.9.0"
classgraph = "4.8.179"
dokka = "2.0.0"
Expand Down Expand Up @@ -31,6 +31,8 @@ kotest-property = { module = "io.kotest:kotest-property", version.ref = "kotest"
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib" }
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test" }
kotlin-testAnnotations = { module = "org.jetbrains.kotlin:kotlin-test-annotations-common" }
kotlin-testJUnit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5" }
kotlinx-knit = { module = "org.jetbrains.kotlinx:kotlinx-knit", version.ref = "knit" }
kotlinx-serializationCore = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinxSerialization" }
kotlinx-serializationJson = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerialization" }
Expand Down

0 comments on commit fda7cf8

Please sign in to comment.