markusthoemmes commented on a change in pull request #3942: make error count
and percentage configurable for gatling tests
URL:
https://github.com/apache/incubator-openwhisk/pull/3942#discussion_r208202442
##
File path:
tests/performance/gatling_tests/src/gatling/scala/LatencySimulation.scala
##
@@ -91,14 +99,20 @@ class LatencySimulation extends Simulation {
.protocols(openWhiskProtocol)
actions
-.map { case (kind, _, _, _) => s"Warm $kind invocation" }
-.foldLeft(testSetup) { (agg, cur) =>
+.map { case (kind, _, _, _) => kind }
+.foldLeft(testSetup) { (agg, kind) =>
+ val cur = s"Warm $kind invocation"
// One failure will make the build yellow
+ val mrt : Int = sys.env.getOrElse(kind.split(":").head.toUpperCase + "_"
+ MEAN_RESPONSE_TIME, meanResponseTime.toString).toInt
+ val maxrt = sys.env.getOrElse(kind.split(":").head.toUpperCase + "_" +
MAX_MEAN_RESPONSE_TIME, maximalMeanResponseTime.toString).toInt
+ val maxerr = sys.env.getOrElse(kind.split(":").head.toUpperCase + "_" +
MAX_ERRORS_ALLOWED, maxErrorsAllowed.toString).toInt
+ val maxerrp = sys.env.getOrElse(kind.split(":").head.toUpperCase + "_" +
MAX_ERRORS_ALLOWED_PERCENTAGE, maxErrorsAllowedPercentage.toString).toDouble
Review comment:
Does it make sense to exclude this into a function to prevent duplication,
like:
```scala
def toKindSpecificKey(kind: String, suffix: String) =
kind.split(':').head.toUpperCase + "_" + suffix
```
To be used like:
```scala
val mrt: Int = sys.env.getOrElse(toKindSpecificKey(kind, MEAN_RESPONSE_TIME)
, meanResponseTime.toString).toInt
```
Also: No need to abbreviate the constant names here. Please make them "fully
qualified" to be readable more easily, like: `specificMeanResponseTime`,
`specificMaxResponseTime` etc.
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org
With regards,
Apache Git Services