Skip to content

Instantly share code, notes, and snippets.

@ygrenzinger
Created January 5, 2016 13:56
Show Gist options
  • Save ygrenzinger/0b2078da1e8ddf2c4111 to your computer and use it in GitHub Desktop.
Save ygrenzinger/0b2078da1e8ddf2c4111 to your computer and use it in GitHub Desktop.
Gatling loadtest for aiguillage
package cos
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class RecordedSimulation extends Simulation {
val localhostUrl = "http://127.0.0.1:3000"
val httpConf = http
.baseURL(localhostUrl + "/service")
.disableFollowRedirect
.userAgentHeader("Gatling")
val contractId_header = Map("contractId" -> "1")
val subscriberId_header = Map("subscriberId" -> "42")
val certificate_header = Map("X-CPGRP-STB" -> "MSD:13747378261130 NUID:0xDEADBEEF CASN:0xB16BADCA")
val scnStaticRedirects = scenario("static redirect")
.exec(
http("simple redirect with querystring")
.get("/static_with_querystring?querystring=test")
.check(status.is(307))
.check(header("Location").is("http://www.google.com?querystring=test"))
).pause(2)
.exec(
http("redirect with vector condition")
.get("/static_vector_cond/vector/50000")
.check(status.is(307))
.check(header("Location").is("http://www.google.com"))
).pause(2)
.exec(
http("redirect with alias condition")
.get("/static_alias_cond")
.headers(contractId_header)
.check(status.is(307))
.check(header("Location").is("http://www.google.com"))
)
val scnWithMultipleConds = scenario("static redirect with multiple conditions")
.exec(
http("static redirect with multiple conditions")
.get("/static_with_multiple_cond/vector/60000?querystring=test")
.headers(subscriberId_header)
.check(status.is(307))
.check(header("Location").is("http://www.canalplus-reunion.com?querystring=test"))
)
val scnAboProfileRedirects = scenario("AboProfile redirect")
.exec(
http("aboProfile redirect with vector cond")
.get("/aboprofile_vector_cond?vector=50000")
.headers(certificate_header)
.check(status.is(307))
.check(header("Location").is("http://www.google.com"))
).pause(2)
.exec(
http("aboProfile redirect with rule cond")
.get("/aboprofile_rule_cond")
.headers(certificate_header)
.check(status.is(307))
.check(header("Location").is("http://www.google.com"))
).pause(2)
.exec(
http("aboProfile redirect with macro cond")
.get("/aboprofile_macro_cond")
.headers(certificate_header)
.check(status.is(307))
.check(header("Location").is("http://www.google.com"))
)
.exec(
http("aboProfile redirect with full cond")
.get("/aboprofile_full_cond")
.headers(certificate_header)
.check(status.is(307))
.check(header("Location").is("http://www.canalplus-reunion.com?subscriber=40fa6b3e84fd82502689c356a5a14d8a&zone=65&labelZone=Antilles%20%2F%20Guyane&macros=[LVTV_ANT,TVCP_ANT,TVCSAT_ANT,CPALD_ANT,CINEPALD_ANT,SERVICES_MUS,TVCP_AFR,SERVICES_AFR]&rules=[LVTV_ANT:[RLVTV_ANT_LB_C5,RLVTV_ANT_LB,RLVTV_ANT_LA,RLVTV_ANT_LF_C5,RLVTV_ANT_LF,RLVTV_ANT_LC,RLVTV_ANT_LE,RLVTV_ANT_LD],SERVICES_ANT:[RAPP_FOOT_ANT,RAPP_F1_ANT,RAPP_RUGBY_ANT],CPALD_ANT:[RCPALD_OTT_ANT,RCPALD_PUSH_ANT],CINEPALD_ANT:[RCINEPALD_PUSH_ANT],LVTV_REU:[], SERVICES_REU:[-1],CPALD_REU:[],CINEPALD_REU:[],LVTV_MUS:[], SERVICES_MUS:[-1],CPALD_MUS:[],CINEPALD_MUS:[-1],LVTV_CAL:[], SERVICES_CAL:[-1],CPALD_CAL:[],CINEPALD_CAL:[],LVTV_AFR:[], SERVICES_AFR:[-1], CPALD_AFR:[-1],LVTV_MDG:[-1], SERVICES_MDG:[-1],CPALD_MDG:[-1],CINEPALD_MDG:[-1]]"))
)
setUp(
scnStaticRedirects.inject(rampUsers(200) over (10 seconds)).protocols(httpConf),
scnWithMultipleConds.inject(rampUsers(200) over (10 seconds)).protocols(httpConf),
scnAboProfileRedirects.inject(rampUsers(200) over (10 seconds)).protocols(httpConf)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment