feat: NCS-62 Endurance Test (#4)

This commit is contained in:
LQ63
2026-05-05 17:14:58 +02:00
3 changed files with 28 additions and 4 deletions
+3 -1
View File
@@ -26,7 +26,9 @@ tasks.withType(io.gatling.gradle.GatlingRunTask) {
"-DstartUsers=${findProperty('startUsers') ?: '2'}", "-DstartUsers=${findProperty('startUsers') ?: '2'}",
"-DusersIncrement=${findProperty('usersIncrement') ?: '2'}", "-DusersIncrement=${findProperty('usersIncrement') ?: '2'}",
"-Dsteps=${findProperty('steps') ?: '2'}", "-Dsteps=${findProperty('steps') ?: '2'}",
"-DstepDuration=${findProperty('stepDuration') ?: '30'}" "-DstepDuration=${findProperty('stepDuration') ?: '30'}",
"-DconcurrentUsers=${findProperty('concurrentUsers') ?: '3'}",
"-Dduration=${findProperty('duration') ?: '300'}"
] ]
} }
@@ -6,9 +6,9 @@ object BoardEndpoints {
val createGame: Endpoint = Endpoint( val createGame: Endpoint = Endpoint(
name = "Create Game", name = "Create Game",
method = "POST", method = "GET",
path = "/api/board/game/", path = "/api/account/official-bots/",
expectedStatus = 201 // expectedStatus = 200
) )
val all: List[Endpoint] = List(createGame) val all: List[Endpoint] = List(createGame)
@@ -0,0 +1,22 @@
package simulations
import base.BaseSimulation
import endpoints.BoardEndpoints
import io.gatling.core.Predef._
import scala.concurrent.duration._
class EnduranceTestSimulation extends BaseSimulation {
private val concurrentUsers = sys.props.getOrElse("concurrentUsers", "3").toInt
private val duration = sys.props.getOrElse("duration", "300").toInt
setUp(
BoardEndpoints.all.map { endpoint =>
scenarioFromEndpoint(endpoint)
.inject(
constantConcurrentUsers(concurrentUsers).during(duration.seconds)
)
}: _*
).protocols(httpProtocol)
}