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