Change SSL cert used in feeder per request?

549 views
Skip to first unread message

Maciej Grzymkowski

unread,
Feb 24, 2015, 6:35:49 AM2/24/15
to gat...@googlegroups.com

Hi everyone, is it possible in Gatling to use feeder with different certificate for every request?

I've also asked this question on SO (http://stackoverflow.com/questions/28694659/gatling-change-ssl-cert-used-in-feeder-per-request), but a colleague pointed me to your google group.

Consider the test:

  • for a number of users, each has a personal, unique certificate used for HTTPS connection,
  • for every user, send a request, using that user's certificate.

Example implementation:

val feeder = Array(
  Map("data" -> data(user1_data),
    "gatling.http.ssl.trustStore.file" -> "/tmp/test-data/rb.jks",
    "gatling.http.ssl.trustStore.password" -> "password",
    "gatling.http.ssl.keyStore.file" -> "/tmp/test-data/user1.jks",
    "gatling.http.ssl.keyStore.password" -> "password"),

  Map("data" -> data(user2_data),
    "gatling.http.ssl.trustStore.file" -> "/tmp/test-data/rb.jks",
    "gatling.http.ssl.trustStore.password" -> "password",
    "gatling.http.ssl.keyStore.file" -> "/tmp/test-data/user2.jks",
    "gatling.http.ssl.keyStore.password" -> "password")
)
...
val scn = scenario.exec(reportableTest(
  repeat(feeder.length) {
    feed(feeder)
    .exec(http("test user personal data")
    .post(user_url)
    .headers(user_headers)
    .body(StringBody("${data}")).asJSON
    .check(
      status.is(201),
      header("Content-type").is("application/json"),
    )
}))

I did call: .disableClientSharing in scenario setup.

The weird behaviour is, it seems that only the first

"gatling.http.ssl.keyStore.file" -> "/tmp/test-data/user1.jks",

is processed. The next are not (even if I create another reportableTest). I've simply changed the order to see that in fact in both request the first "userX.jks" is being used.

Is this the normal behaviour? Is it a bug?

I'm running Gatling 2.1.4, the same behaviour occured in 2.1.2.

Stéphane LANDELLE

unread,
Feb 24, 2015, 8:40:45 AM2/24/15
to gat...@googlegroups.com
You get it wrong. You can use a different SSL config per virtual user, not per request.

Stéphane Landelle
Lead developer


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Arrowwood

unread,
Feb 24, 2015, 11:18:56 AM2/24/15
to gat...@googlegroups.com
Doesn't that mean that if each virtual user does one request and then exits, each will have a different SSL config?

Maciej Grzymkowski

unread,
Feb 24, 2015, 4:19:20 PM2/24/15
to gat...@googlegroups.com
Thanks for help! As it turned out, these lines:


val scn = scenario.exec(reportableTest(
  repeat(feeder.length) {
    feed(feeder)

caused all the feeder requests to be consumed by a single user, hence only on set of certs was used. Removing that, adding another user solved the issue (indeed, adding users helped).

Senthil Nathan

unread,
Feb 17, 2016, 1:01:38 AM2/17/16
to Gatling User Group
Hi guys,

I am trying to feed certificates as part of HTTPS request as below  : 


  val feeder_Certificates = Array(
    Map( 
    "gatling.http.ssl.trustStore.file" -> "/user-files/Certificates/nft_truststore.jks",
    "gatling.http.ssl.trustStore.password" -> "password",
    "gatling.http.ssl.keyStore.file" -> "/user-files/Certificates/nft_keystore.jks",
    "gatling.http.ssl.keyStore.password" -> "password"))

  println(">> Running simulation for " + duration + " seconds <<")

  val ChannelSimulationScenario = scenario ("Channeltransactions")
    .feed(feeder_Certificates)
    .forever(
      pace(40 seconds, 80 seconds)
        .exec(App.InitialiseApp).pause(3 seconds, 7 seconds)
        .exec(api.validateToken).pause(3 seconds, 7 seconds))

In the session I can see the reference to the trustStore file & KeyStore file however the certificates doesn't get sent to the application. 

Session:
Session(Channeltransactions,4659084711907998562-0,Map(gatling.http.ssl.keyStore.password -> password, 764bba98-7210-45b7-9ca3-5f5f51f7b13f -> 1455688053256, gatling.http.ssl.trustStore.password -> password, gatling.http.ssl.keyStore.file -> /user-files/Certificates/nft_keystore.jks, d24fc830-f69e-4a66-86fd-592969d12ebd -> 0, timestamp.d24fc830-f69e-4a66-86fd-592969d12ebd -> 1455687995035, gatling.http.ssl.trustStore.file -> /user-files/Certificates/nft_truststore.jks),1455687995023,0,OK,List(ExitOnCompleteLoopBlock(d24fc830-f69e-4a66-86fd-592969d12ebd)),<function1>)

What could be wrong ? any help is appreciated
Reply all
Reply to author
Forward
0 new messages