Skip to content

Commit 16f29f7

Browse files
committed
test: use @RepeatedTest in ReplicatedRepositoryTest
1 parent 1013fa1 commit 16f29f7

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed

model-server/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ dependencies {
6565
testImplementation(kotlin("test"))
6666
}
6767

68+
tasks.test {
69+
useJUnitPlatform()
70+
}
71+
6872
val cucumberRuntime by configurations.creating {
6973
extendsFrom(configurations["testImplementation"])
7074
}

model-server/src/test/kotlin/org/modelix/model/server/ReplicatedRepositoryTest.kt

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import kotlinx.coroutines.coroutineScope
2626
import kotlinx.coroutines.delay
2727
import kotlinx.coroutines.launch
2828
import kotlinx.coroutines.withTimeout
29+
import org.junit.jupiter.api.RepeatedTest
30+
import org.junit.jupiter.api.RepetitionInfo
2931
import org.modelix.authorization.installAuthentication
3032
import org.modelix.model.LinearHistory
3133
import org.modelix.model.ModelFacade
@@ -127,27 +129,8 @@ class ReplicatedRepositoryTest {
127129
}
128130
}
129131

130-
@Test fun `concurrent write 0`() = concurrentWrite(0)
131-
132-
@Test fun `concurrent write 1`() = concurrentWrite(1)
133-
134-
@Test fun `concurrent write 2`() = concurrentWrite(2)
135-
136-
@Test fun `concurrent write 3`() = concurrentWrite(3)
137-
138-
@Test fun `concurrent write 4`() = concurrentWrite(4)
139-
140-
@Test fun `concurrent write 5`() = concurrentWrite(5)
141-
142-
@Test fun `concurrent write 6`() = concurrentWrite(6)
143-
144-
@Test fun `concurrent write 7`() = concurrentWrite(7)
145-
146-
@Test fun `concurrent write 8`() = concurrentWrite(8)
147-
148-
@Test fun `concurrent write 9`() = concurrentWrite(9)
149-
150-
fun concurrentWrite(iteration: Int) = runTest { scope ->
132+
@RepeatedTest(value = 10)
133+
fun concurrentWrite(repetitionInfo: RepetitionInfo) = runTest { scope ->
151134
val url = "http://localhost/v2"
152135
val clients = (1..3).map {
153136
ModelClientV2.builder().url(url).client(client).build().also { it.init() }
@@ -175,7 +158,7 @@ class ReplicatedRepositoryTest {
175158
}
176159
}
177160
models.forEachIndexed { index, model ->
178-
launchWriter(model, 56456 + index + iteration * 100000)
161+
launchWriter(model, 56456 + index + repetitionInfo.currentRepetition * 100000)
179162
delay(200.milliseconds)
180163
}
181164
}

0 commit comments

Comments
 (0)