Reputation: 63
I have a scenario where I am preparing the request for a user and then hitting 2 endpoints with the same request
val scenario9 = scenario("All end points")
.feed(feeder)
.exec(session => {
val uniqueId = session("uniqueId").as[Int]
val startIdx = Math.min(30 * (uniqueId - 1) + 0, 49951)
val endIdx = Math.min(startIdx + 30 + 0, 49951)
val dynamicArray = fullarray.slice(startIdx, endIdx)
.map(elm => s""""$elm"""")
.mkString("[", ",", "]")
session.set("requestArray", dynamicArray)
})
.exec(http("test1" )
.post("/endpoint1")
.body(ElFileBody("./performance/resources/Req1.json")).asJson
.check(status.in(200))
)
.exec(http("test2" )
.post("/endpoint2")
.body(ElFileBody("./performance/resources/Req1.json")).asJson
.check(status.in(200))
)
If I do this, endpoint1 gets called and then endpoint2 isn't called until I get the response from endpoint1. I need to call these 2 endpoints parallely. I've tried using .resources but it doesn't work.
val scenario9 = scenario("All end points")
.feed(feeder)
.exec(session => {
val uniqueId = session("uniqueId").as[Int]
val startIdx = Math.min(30 * (uniqueId - 1) + 0, 49951)
val endIdx = Math.min(startIdx + 30 + 0, 49951)
val dynamicArray = fullarray.slice(startIdx, endIdx)
.map(elm => s""""$elm"""")
.mkString("[", ",", "]")
session.set("requestArray", dynamicArray)
})
.resources(
http("test1" )
.post("/endpoint1")
.body(ElFileBody("./performance/resources/Req1.json")).asJson
.check(status.in(200)),
http("test2" )
.post("/endpoint2")
.body(ElFileBody("./performance/resources/Req1.json")).asJson
.check(status.in(200))
)
Anything else that I could try?
Upvotes: 0
Views: 17
Reputation: 6600
"resources" can only be used as a child of a parent HTTP request.
What you're looking for is not supported yet, see https://github.com/gatling/gatling/issues/3783
Upvotes: 0