Skip to content

Commit

Permalink
chore: clean up args passing from sbt test framework
Browse files Browse the repository at this point in the history
  • Loading branch information
slandelle committed Apr 25, 2024
1 parent 7e7120f commit 9994958
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions gatling-app/src/main/scala/io/gatling/app/Gatling.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import scala.util.control.NonFatal
import io.gatling.app.cli.GatlingArgsParser
import io.gatling.core.cli.GatlingArgs
import io.gatling.core.config.GatlingConfiguration
import io.gatling.core.scenario.Simulation
import io.gatling.netty.util.Transports
import io.gatling.shared.cli.GatlingCliOptions

import akka.actor.ActorSystem
import com.typesafe.scalalogging.StrictLogging
Expand All @@ -45,10 +43,7 @@ object Gatling extends StrictLogging {
}

// used by sbt-test-framework
private[gatling] def fromSbtTestFramework(args: Array[String], selectedSimulationClass: Class[Simulation]): Int =
fromArgs(args ++ Array(s"-${GatlingCliOptions.Simulation}", selectedSimulationClass.getName))

private def fromArgs(args: Array[String]): Int =
private[gatling] def fromArgs(args: Array[String]): Int =
new GatlingArgsParser(args).parseArguments match {
case Left(gatlingArgs) => start(gatlingArgs)
case Right(statusCode) => statusCode.code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class GatlingTask(val taskDef: TaskDef, testClassLoader: ClassLoader, args: Arra
val before = System.nanoTime()
val (returnCode, exception) =
try {
(Gatling.fromSbtTestFramework(args ++ Array("-" + GatlingCliOptions.Launcher.abbr, "sbt"), simulationClass), None)
(Gatling.fromArgs(args ++ Array("-" + GatlingCliOptions.Simulation.abbr, simulationClass.getName, "-" + GatlingCliOptions.Launcher.abbr, "sbt")), None)
} catch {
case e: Exception =>
val sw = new StringWriter
Expand Down

0 comments on commit 9994958

Please sign in to comment.