Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not run flaky tests on corresponding platforms #3555

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 3 additions & 0 deletions arrow-libs/core/arrow-platform/api/arrow-platform.api
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ public final class arrow/platform/PlatformKt {
public static final fun stackSafeIteration ()I
}

public abstract interface annotation class arrow/platform/test/NonFlakyOnThisPlatform : java/lang/annotation/Annotation {
}

4 changes: 4 additions & 0 deletions arrow-libs/core/arrow-platform/api/arrow-platform.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
// - Show declarations: true

// Library unique name: <io.arrow-kt:arrow-platform>
open annotation class arrow.platform.test/NonFlakyOnThisPlatform : kotlin/Annotation { // arrow.platform.test/NonFlakyOnThisPlatform|null[0]
constructor <init>() // arrow.platform.test/NonFlakyOnThisPlatform.<init>|<init>(){}[0]
}

final enum class arrow.platform/Platform : kotlin/Enum<arrow.platform/Platform> { // arrow.platform/Platform|null[0]
enum entry JS // arrow.platform/Platform.JS|null[0]
enum entry JVM // arrow.platform/Platform.JVM|null[0]
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