feat(Gatlin): Spike Test

Added a spike test.
This commit is contained in:
LQ63
2026-05-04 16:03:15 +02:00
parent 0db2bb777f
commit 49b6a148ce
2 changed files with 30 additions and 1 deletions
+4 -1
View File
@@ -22,7 +22,10 @@ tasks.withType(io.gatling.gradle.GatlingRunTask) {
"-Dgatling.authToken=${findProperty('authToken') ?: System.getenv('GATLING_AUTH_TOKEN') ?: ''}",
"-Dhealthz.path=${findProperty('healthzPath') ?: '/health'}",
"-DmaxUsers=${findProperty('maxUsers') ?: '10'}",
"-DrampDuration=${findProperty('rampDuration') ?: '60'}"
"-DrampDuration=${findProperty('rampDuration') ?: '60'}",
"-DbaselineUsers=${findProperty('baselineUsers') ?: '2'}",
"-DbaselineDuration=${findProperty('baselineDuration') ?: '20'}",
"-DspikeUsers=${findProperty('spikeUsers') ?: '15'}"
]
}
@@ -0,0 +1,26 @@
package simulations
import base.BaseSimulation
import endpoints.BoardEndpoints
import io.gatling.core.Predef._
import scala.concurrent.duration._
class SpikeTestSimulation extends BaseSimulation {
private val baselineUsers = sys.props.getOrElse("baselineUsers", "2").toInt
private val baselineDuration = sys.props.getOrElse("baselineDuration", "20").toInt
private val spikeUsers = sys.props.getOrElse("spikeUsers", "15").toInt
setUp(
BoardEndpoints.all.map { endpoint =>
scenarioFromEndpoint(endpoint)
.inject(
constantUsersPerSec(baselineUsers).during(baselineDuration.seconds),
atOnceUsers(spikeUsers),
nothingFor(5.seconds),
constantUsersPerSec(baselineUsers).during(baselineDuration.seconds)
)
}: _*
).protocols(httpProtocol)
}