feat: NCS-64 Spike Test #5

Closed
lq64 wants to merge 1 commits from feat/NCS-64 into main
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') ?: ''}", "-Dgatling.authToken=${findProperty('authToken') ?: System.getenv('GATLING_AUTH_TOKEN') ?: ''}",
"-Dhealthz.path=${findProperty('healthzPath') ?: '/health'}", "-Dhealthz.path=${findProperty('healthzPath') ?: '/health'}",
"-DmaxUsers=${findProperty('maxUsers') ?: '10'}", "-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)
}