From 19aa404243edc5b67ce7016aa7e94f03357ebee6 Mon Sep 17 00:00:00 2001 From: John Axe Date: Tue, 25 Jun 2024 13:39:04 -0300 Subject: [PATCH 1/2] feat: update gatling 3.11.4 --- project/Dependencies.scala | 2 +- project/build.properties | 2 +- project/plugins.sbt | 2 +- .../gatling/jdbc/actions/DBBatchAction.scala | 5 ++++- .../gatling/jdbc/actions/DBCallAction.scala | 4 +++- .../gatling/jdbc/actions/DBInsertAction.scala | 4 +++- .../gatling/jdbc/actions/DBQueryAction.scala | 5 ++++- .../jdbc/actions/DBRawQueryAction.scala | 5 ++++- .../galaxio/performance/GatlingRunner.scala | 19 +++++++++++++------ .../performance/jdbc/test/GatlingRunner.scala | 17 ++++++++++++----- 10 files changed, 46 insertions(+), 19 deletions(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 72e38d4..358172d 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -2,7 +2,7 @@ import sbt.* object Dependencies { - val gatlingVersion = "3.10.5" + val gatlingVersion = "3.11.4" lazy val gatlingCore: Seq[ModuleID] = Seq( "io.gatling" % "gatling-core", diff --git a/project/build.properties b/project/build.properties index 66d9e4b..4067c48 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1,2 +1,2 @@ # suppress inspection "UnusedProperty" -sbt.version=1.9.9 +sbt.version=1.10.0 diff --git a/project/plugins.sbt b/project/plugins.sbt index 818cbd0..93a0c84 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("io.gatling" % "gatling-sbt" % "4.7.0") +addSbtPlugin("io.gatling" % "gatling-sbt" % "4.9.0") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.12") diff --git a/src/main/scala/org/galaxio/gatling/jdbc/actions/DBBatchAction.scala b/src/main/scala/org/galaxio/gatling/jdbc/actions/DBBatchAction.scala index 5d994c1..cbdf8a8 100644 --- a/src/main/scala/org/galaxio/gatling/jdbc/actions/DBBatchAction.scala +++ b/src/main/scala/org/galaxio/gatling/jdbc/actions/DBBatchAction.scala @@ -7,6 +7,7 @@ import io.gatling.core.session.{Expression, Session} import io.gatling.core.structure.ScenarioContext import io.gatling.core.util.NameGen import actions.{BatchAction, BatchInsertAction, BatchUpdateAction} +import io.gatling.core.stats.StatsEngine import org.galaxio.gatling.jdbc.db._ final case class DBBatchAction( @@ -80,7 +81,7 @@ final case class DBBatchAction( )) .onFailure(m => batchName(session).map { rn => - ctx.coreComponents.statsEngine.logCrash(session.scenario, session.groups, rn, m) + ctx.coreComponents.statsEngine.logRequestCrash(session.scenario, session.groups, rn, m) executeNext( session, ctx.coreComponents.clock.nowMillis, @@ -94,4 +95,6 @@ final case class DBBatchAction( }, ) } + + override def statsEngine: StatsEngine = ctx.coreComponents.statsEngine } diff --git a/src/main/scala/org/galaxio/gatling/jdbc/actions/DBCallAction.scala b/src/main/scala/org/galaxio/gatling/jdbc/actions/DBCallAction.scala index 60b6d97..b16c89a 100644 --- a/src/main/scala/org/galaxio/gatling/jdbc/actions/DBCallAction.scala +++ b/src/main/scala/org/galaxio/gatling/jdbc/actions/DBCallAction.scala @@ -4,6 +4,7 @@ import io.gatling.commons.stats.{KO, OK} import io.gatling.commons.validation._ import io.gatling.core.action.{Action, ChainableAction} import io.gatling.core.session.{Expression, Session} +import io.gatling.core.stats.StatsEngine import io.gatling.core.structure.ScenarioContext import io.gatling.core.util.NameGen import org.galaxio.gatling.jdbc.db.SQL @@ -48,7 +49,7 @@ case class DBCallAction( )) .onFailure(m => requestName(session).map { rn => - ctx.coreComponents.statsEngine.logCrash(session.scenario, session.groups, rn, m) + ctx.coreComponents.statsEngine.logRequestCrash(session.scenario, session.groups, rn, m) executeNext( session, ctx.coreComponents.clock.nowMillis, @@ -62,4 +63,5 @@ case class DBCallAction( }, ) + override def statsEngine: StatsEngine = ctx.coreComponents.statsEngine } diff --git a/src/main/scala/org/galaxio/gatling/jdbc/actions/DBInsertAction.scala b/src/main/scala/org/galaxio/gatling/jdbc/actions/DBInsertAction.scala index 2cab913..601c833 100644 --- a/src/main/scala/org/galaxio/gatling/jdbc/actions/DBInsertAction.scala +++ b/src/main/scala/org/galaxio/gatling/jdbc/actions/DBInsertAction.scala @@ -4,6 +4,7 @@ import io.gatling.commons.stats.{KO, OK} import io.gatling.commons.validation._ import io.gatling.core.action.{Action, ChainableAction} import io.gatling.core.session.{Expression, Session} +import io.gatling.core.stats.StatsEngine import io.gatling.core.structure.ScenarioContext import io.gatling.core.util.NameGen import org.galaxio.gatling.jdbc.db.SQL @@ -39,7 +40,7 @@ case class DBInsertAction( )) .onFailure(m => requestName(session).map { rn => - ctx.coreComponents.statsEngine.logCrash(session.scenario, session.groups, rn, m) + ctx.coreComponents.statsEngine.logRequestCrash(session.scenario, session.groups, rn, m) executeNext( session, ctx.coreComponents.clock.nowMillis, @@ -53,4 +54,5 @@ case class DBInsertAction( }, ) + override def statsEngine: StatsEngine = ctx.coreComponents.statsEngine } diff --git a/src/main/scala/org/galaxio/gatling/jdbc/actions/DBQueryAction.scala b/src/main/scala/org/galaxio/gatling/jdbc/actions/DBQueryAction.scala index cf3046c..dbd922c 100644 --- a/src/main/scala/org/galaxio/gatling/jdbc/actions/DBQueryAction.scala +++ b/src/main/scala/org/galaxio/gatling/jdbc/actions/DBQueryAction.scala @@ -5,6 +5,7 @@ import io.gatling.commons.validation.{Failure => GFailure, _} import io.gatling.core.action.{Action, ChainableAction} import io.gatling.core.check.Check import io.gatling.core.session.{Expression, Session} +import io.gatling.core.stats.StatsEngine import io.gatling.core.structure.ScenarioContext import io.gatling.core.util.NameGen import org.galaxio.gatling.jdbc.db.SQL @@ -72,7 +73,7 @@ case class DBQueryAction( )) .onFailure(m => requestName(session).map { rn => - ctx.coreComponents.statsEngine.logCrash(session.scenario, session.groups, rn, m) + ctx.coreComponents.statsEngine.logRequestCrash(session.scenario, session.groups, rn, m) executeNext( session, ctx.coreComponents.clock.nowMillis, @@ -85,4 +86,6 @@ case class DBQueryAction( ) }, ) + + override def statsEngine: StatsEngine = ctx.coreComponents.statsEngine } diff --git a/src/main/scala/org/galaxio/gatling/jdbc/actions/DBRawQueryAction.scala b/src/main/scala/org/galaxio/gatling/jdbc/actions/DBRawQueryAction.scala index 81c2b87..c7faedd 100644 --- a/src/main/scala/org/galaxio/gatling/jdbc/actions/DBRawQueryAction.scala +++ b/src/main/scala/org/galaxio/gatling/jdbc/actions/DBRawQueryAction.scala @@ -4,6 +4,7 @@ import io.gatling.commons.stats.{KO, OK} import io.gatling.commons.validation._ import io.gatling.core.action.{Action, ChainableAction} import io.gatling.core.session.{Expression, Session} +import io.gatling.core.stats.StatsEngine import io.gatling.core.structure.ScenarioContext import io.gatling.core.util.NameGen import org.galaxio.gatling.jdbc.db.SQL @@ -36,7 +37,7 @@ case class DBRawQueryAction(requestName: Expression[String], query: Expression[S )) .onFailure(m => requestName(session).map { rn => - ctx.coreComponents.statsEngine.logCrash(session.scenario, session.groups, rn, m) + ctx.coreComponents.statsEngine.logRequestCrash(session.scenario, session.groups, rn, m) executeNext( session, ctx.coreComponents.clock.nowMillis, @@ -49,4 +50,6 @@ case class DBRawQueryAction(requestName: Expression[String], query: Expression[S ) }, ) + + override def statsEngine: StatsEngine = ctx.coreComponents.statsEngine } diff --git a/src/test/java/org/galaxio/performance/GatlingRunner.scala b/src/test/java/org/galaxio/performance/GatlingRunner.scala index afe8c0d..a5d3940 100644 --- a/src/test/java/org/galaxio/performance/GatlingRunner.scala +++ b/src/test/java/org/galaxio/performance/GatlingRunner.scala @@ -1,8 +1,8 @@ package org.galaxio.performance import io.gatling.app.Gatling -import io.gatling.core.config.GatlingPropertiesBuilder -import org.galaxio.performance.jdbc.test.JdbcDebugTest; +import io.gatling.shared.cli.GatlingCliOptions +import org.galaxio.performance.jdbc.test.JdbcDebugTest object GatlingRunner { @@ -11,10 +11,17 @@ object GatlingRunner { // this is where you specify the class you want to run val simulationClass = classOf[JdbcDebugTest].getName - val props = new GatlingPropertiesBuilder - props.simulationClass(simulationClass) - - Gatling.fromMap(props.build) + Gatling.main( + args ++ + Array( + GatlingCliOptions.Simulation.shortOption, + simulationClass, + GatlingCliOptions.ResultsFolder.shortOption, + "results", + GatlingCliOptions.Launcher.shortOption, + "sbt", + ), + ) } } diff --git a/src/test/scala/org/galaxio/performance/jdbc/test/GatlingRunner.scala b/src/test/scala/org/galaxio/performance/jdbc/test/GatlingRunner.scala index cf41292..9be2edc 100644 --- a/src/test/scala/org/galaxio/performance/jdbc/test/GatlingRunner.scala +++ b/src/test/scala/org/galaxio/performance/jdbc/test/GatlingRunner.scala @@ -1,7 +1,7 @@ package org.galaxio.performance.jdbc.test import io.gatling.app.Gatling -import io.gatling.core.config.GatlingPropertiesBuilder +import io.gatling.shared.cli.GatlingCliOptions object GatlingRunner { @@ -10,10 +10,17 @@ object GatlingRunner { // this is where you specify the class you want to run val simulationClass = classOf[DebugTest].getName - val props = new GatlingPropertiesBuilder - props.simulationClass(simulationClass) - - Gatling.fromMap(props.build) + Gatling.main( + args ++ + Array( + GatlingCliOptions.Simulation.shortOption, + simulationClass, + GatlingCliOptions.ResultsFolder.shortOption, + "results", + GatlingCliOptions.Launcher.shortOption, + "sbt", + ), + ) } } From 9f356844c2c1ff6ed4bde03c7de0e8eddd574fb8 Mon Sep 17 00:00:00 2001 From: John Axe Date: Tue, 25 Jun 2024 18:47:18 -0300 Subject: [PATCH 2/2] feat: update gatling 3.11.4 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 93a0c84..818cbd0 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("io.gatling" % "gatling-sbt" % "4.9.0") +addSbtPlugin("io.gatling" % "gatling-sbt" % "4.7.0") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.12")