Hi,
The cookie is not send with the request with a load balanced Tomcat setup. When i do a post or get it says the user is not logged in. What is going wrong?
Code:
`
package tomcat
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
import java.util.concurrent.ThreadLocalRandom._
import java.util.Calendar
import java.text.SimpleDateFormat
class Starttomcat extends Simulation {
// HTTP Request Configuration
val httpConf = http
.baseURL(“https://example.net”)
.acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8”)
.doNotTrackHeader(“1”)
.acceptLanguageHeader(“nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7”)
.acceptEncodingHeader(“gzip, deflate, br”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36”)
.header(“X-Token”, “no-check”)
.setCookie()
.disableWarmUp
// CSV Feeders
val userFeeder = csv(“users.csv”).circular
val spaceFeeder = csv(“spaces.csv”).circular
val homePages = csv(“homePages.csv”).circular
val homePagesId = csv(“homePagesId.csv”).circular
object Auth {
var users = feed(userFeeder)
val getDashboard = exec(
http(“Request 1 — Login tomcat”)
.get("/")
.check(status.is(200))
)
.pause(5)
val login = exec(
http(“Request 2 — Authorize tomcat”)
.post("/dologin.action")
.queryParam(""“os_username”"", “${username}”)
.queryParam(""“os_password”"", “${password}”)
.check(status.is(200))
.check(regex("""""").saveAs(“authToken”))
.check(regex("""""").saveAs(“nodeId”))
)
.pause(3)
.exec(session => {
val nodeId = session.get(“nodeId”).asOption[String]
println(nodeId)
session
})
val logOut = exec(
http(“Request 15 — Log out of tomcat”)
.get("/login.action")
.queryParam(“logout”, “true”)
)
.exec(flushSessionCookies)
}
object Browse {
var space = feed(spaceFeeder)
val browseDirectory = exec(
http(“Request 3 — Get Space Directory”)
.get("/spacedirectory/view.action")
.check(status.is(200))
)
.pause(5)
val browseSpace = exec(
http(“Request 4 — Get Space Home”)
.get("/display/${space}/Welcome+to+tomcat")
.check(status.is(200))
)
.pause(5)
}
val confluenceUsers = scenario(“tomcat Users”)
.exec(Auth.users)
.repeat(8) {
exec(
Auth.getDashboard,
Auth.login,
Browse.space,
Browse.browseDirectory,
Browse.browseSpace,
Auth.logOut
)
}
// Setup Scenario based on tomcat scenario
setUp(tomcatUsers.inject(
atOnceUsers(5),
rampUsers(15) over (120 seconds),
).protocols(httpConf)
)
}
`