Я запускаю симуляцию с 4 файлами объектов, SIM_ACTIVE_USERS = 200, SIM_RAMP_UP_PERIOD = 10. Я ожидаю, что симуляция завершится sh через 10 секунд с кодом ниже:
class TestGatlingScalaSimulation extends Simulation {
val log: Logger = LoggerFactory.getLogger(classOf[TestGatlingScalaSimulation])
/*val environmentVars = System.getenv().asScala
for ((k,v) <- environmentVars) println(s"key: $k, value: $v")*/
val properties: mutable.Map[String, String] = System.getProperties.asScala
//for ((k,v) <- properties) println(s"key: $k, value: $v")
val activeUsers: Int = properties.getOrElse("SIM_ACTIVE_USERS", "10").asInstanceOf[String].toInt
val period: Int = properties.getOrElse("SIM_RAMP_UP_PERIOD", "10").asInstanceOf[String].toInt
val karateFeatureFiles: List[String] = properties.getOrElse("SIM_FEATURE", "karate/example.feature").split(",").map(_.trim).toList
val protocol: KarateProtocol = karateProtocol()
protocol.nameResolver = (req, ctx) => req.getHeader("karate-name")
val scenarios: List[PopulationBuilder] = karateFeatureFiles.map(karateFeatureFile => {
val create: ScenarioBuilder = scenario(karateFeatureFile).exec(karateFeature(s"classpath:$karateFeatureFile"))
log.info("Running simulation of feature [{}] with [{}] users ramped up in [{}]", karateFeatureFile, activeUsers.toString, period.toString)
create.inject(atOnceUsers(activeUsers)).protocols(protocol)
})
setUp(
scenarios
).maxDuration(period seconds)
}
Однако он завершится только через 7 минут:
BUILD SUCCESSFUL in 7m 0s
6 actionable tasks: 1 executed, 5 up-to-date
Вот так я запускаю Gradle Task:
./gradlew -Pgatling_simulation=performance.TestGatlingScalaSimulation -DSIM_ACTIVE_USERS=200 -DSIM_RAMP
_UP_PERIOD=10 -DSIM_FEATURE="karate/flight/one.feature,karate/flight/two.feature,karate/flight/three.feature,kara
te/flight/four.feature" gatlingRun
Отчет от Гатлинга: