test: add constant for tags
This commit is contained in:
13
src/test/kotlin/eventDemo/Tag.kt
Normal file
13
src/test/kotlin/eventDemo/Tag.kt
Normal file
@@ -0,0 +1,13 @@
|
||||
package eventDemo
|
||||
|
||||
import io.kotest.core.Tag
|
||||
|
||||
object Tag {
|
||||
object Postgresql : Tag()
|
||||
|
||||
object RabbitMQ : Tag()
|
||||
|
||||
object Redis : Tag()
|
||||
|
||||
object Concurrence : Tag()
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package eventDemo.adapter.interfaceLayer.query
|
||||
|
||||
import eventDemo.Tag
|
||||
import eventDemo.business.command.GameCommandHandler
|
||||
import eventDemo.business.command.command.GameCommand
|
||||
import eventDemo.business.command.command.IWantToJoinTheGameCommand
|
||||
@@ -24,7 +25,6 @@ import eventDemo.business.notification.WelcomeToTheGameNotification
|
||||
import eventDemo.libs.event.projection.ProjectionSnapshotRepositoryInMemory
|
||||
import eventDemo.testKoinApplicationWithConfig
|
||||
import io.kotest.assertions.nondeterministic.until
|
||||
import io.kotest.core.NamedTag
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.collections.shouldHaveSize
|
||||
import io.kotest.matchers.equals.shouldBeEqual
|
||||
@@ -44,7 +44,7 @@ import kotlin.time.Duration.Companion.seconds
|
||||
@DelicateCoroutinesApi
|
||||
class GameSimulationTest :
|
||||
FunSpec({
|
||||
tags(NamedTag("postgresql"))
|
||||
tags(Tag.Postgresql)
|
||||
|
||||
test("Simulation of a game") {
|
||||
withTimeout(2.seconds) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package eventDemo.business.command
|
||||
|
||||
import eventDemo.Tag
|
||||
import eventDemo.business.command.command.GameCommand
|
||||
import eventDemo.business.command.command.IWantToJoinTheGameCommand
|
||||
import eventDemo.business.entity.GameId
|
||||
@@ -9,7 +10,6 @@ import eventDemo.business.notification.CommandSuccessNotification
|
||||
import eventDemo.business.notification.Notification
|
||||
import eventDemo.business.notification.WelcomeToTheGameNotification
|
||||
import eventDemo.testKoinApplicationWithConfig
|
||||
import io.kotest.core.NamedTag
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.collections.shouldContain
|
||||
import io.kotest.matchers.equals.shouldBeEqual
|
||||
@@ -25,7 +25,7 @@ import kotlin.time.Duration.Companion.seconds
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
class GameCommandHandlerTest :
|
||||
FunSpec({
|
||||
tags(NamedTag("postgresql"))
|
||||
tags(Tag.Postgresql)
|
||||
|
||||
test("handle a command should execute the command") {
|
||||
withTimeout(5.seconds) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package eventDemo.business.event.projection
|
||||
|
||||
import eventDemo.Tag
|
||||
import eventDemo.business.entity.GameId
|
||||
import eventDemo.business.entity.Player
|
||||
import eventDemo.business.event.GameEventHandler
|
||||
@@ -9,7 +10,6 @@ import eventDemo.business.event.projection.gameState.GameStateRepository
|
||||
import eventDemo.testKoinApplicationWithConfig
|
||||
import io.kotest.assertions.nondeterministic.eventually
|
||||
import io.kotest.assertions.nondeterministic.eventuallyConfig
|
||||
import io.kotest.core.NamedTag
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.collections.shouldHaveSize
|
||||
import io.kotest.matchers.equals.shouldBeEqual
|
||||
@@ -24,7 +24,7 @@ import kotlin.time.Duration.Companion.seconds
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
class GameStateRepositoryTest :
|
||||
FunSpec({
|
||||
tags(NamedTag("postgresql"))
|
||||
tags(Tag.Postgresql)
|
||||
|
||||
val player1 = Player("Tesla")
|
||||
val player2 = Player(name = "Einstein")
|
||||
@@ -116,6 +116,8 @@ class GameStateRepositoryTest :
|
||||
}
|
||||
|
||||
test("getUntil should be concurrently secure") {
|
||||
tags(Tag.Concurrence)
|
||||
|
||||
val aggregateId = GameId()
|
||||
testKoinApplicationWithConfig {
|
||||
val repo = get<GameStateRepository>()
|
||||
@@ -155,5 +157,7 @@ class GameStateRepositoryTest :
|
||||
}
|
||||
}
|
||||
|
||||
xtest("get should be concurrently secure") { }
|
||||
xtest("get should be concurrently secure") {
|
||||
tags(Tag.Concurrence)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package eventDemo.externalServices
|
||||
|
||||
import eventDemo.Tag
|
||||
import eventDemo.testKoinApplicationWithConfig
|
||||
import io.kotest.core.NamedTag
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.equals.shouldBeEqual
|
||||
import javax.sql.DataSource
|
||||
|
||||
class PostgresqlTest :
|
||||
FunSpec({
|
||||
tags(NamedTag("postgresql"))
|
||||
tags(Tag.Postgresql)
|
||||
|
||||
test("test connection with postgresql") {
|
||||
testKoinApplicationWithConfig {
|
||||
|
||||
@@ -5,9 +5,9 @@ import com.rabbitmq.client.BuiltinExchangeType
|
||||
import com.rabbitmq.client.ConnectionFactory
|
||||
import com.rabbitmq.client.DefaultConsumer
|
||||
import com.rabbitmq.client.Envelope
|
||||
import eventDemo.Tag
|
||||
import eventDemo.testKoinApplicationWithConfig
|
||||
import io.kotest.assertions.nondeterministic.eventually
|
||||
import io.kotest.core.NamedTag
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.string.shouldStartWith
|
||||
import io.mockk.mockk
|
||||
@@ -18,7 +18,7 @@ import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
class RabbitMQTest :
|
||||
FunSpec({
|
||||
tags(NamedTag("rabbitmq"))
|
||||
tags(Tag.RabbitMQ)
|
||||
|
||||
test("test connection with RabbitMQ") {
|
||||
testKoinApplicationWithConfig {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package eventDemo.externalServices
|
||||
|
||||
import io.kotest.core.NamedTag
|
||||
import eventDemo.Tag
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.equals.shouldBeEqual
|
||||
import redis.clients.jedis.JedisPooled
|
||||
@@ -9,7 +9,7 @@ private val redisUrl = "redis://localhost:6379"
|
||||
|
||||
class RedisTest :
|
||||
FunSpec({
|
||||
tags(NamedTag("redis"))
|
||||
tags(Tag.Redis)
|
||||
|
||||
xtest("test connection with jedis") {
|
||||
JedisPooled(redisUrl).also {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package eventDemo.libs.event
|
||||
|
||||
import eventDemo.Tag
|
||||
import eventDemo.testKoinApplicationWithConfig
|
||||
import io.kotest.core.NamedTag
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.datatest.withData
|
||||
import io.kotest.matchers.collections.shouldHaveSize
|
||||
@@ -19,7 +19,7 @@ import kotlin.test.assertNotNull
|
||||
@DelicateCoroutinesApi
|
||||
class EventStreamTest :
|
||||
FunSpec({
|
||||
tags(NamedTag("postgresql"))
|
||||
tags(Tag.Postgresql)
|
||||
|
||||
fun EventStream<EventXTest, IdTest>.with3Events(block: EventStream<EventXTest, IdTest>.(id: IdTest) -> Unit) =
|
||||
also {
|
||||
@@ -103,6 +103,8 @@ class EventStreamTest :
|
||||
}
|
||||
|
||||
context("publish should be concurrently secure") {
|
||||
tags(Tag.Concurrence)
|
||||
|
||||
testKoinApplicationWithConfig {
|
||||
withData(eventStreams()) { stream ->
|
||||
(0..9)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package eventDemo.libs.event
|
||||
|
||||
import eventDemo.Tag
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.equals.shouldBeEqual
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
@@ -22,6 +23,8 @@ class VersionBuilderLocalTest :
|
||||
}
|
||||
|
||||
test("buildNextVersion concurrently") {
|
||||
tags(Tag.Concurrence)
|
||||
|
||||
val versionBuilder = VersionBuilderLocal()
|
||||
val id = IdTest()
|
||||
(1..20)
|
||||
|
||||
Reference in New Issue
Block a user