I want to be able to specify to use a proxy or not for my Simulation class.
I have this:
class KubtestSimulation extends Simulation {
val myProperty = sys.props.get(“gatling.Miljo”).mkString
val proxy = sys.props.get(“gatling.Proxy”).mkString
println("Miljo: " + myProperty)
println("Proxy: " + proxy)
val httpProtocolProxy = http.proxy(Proxy(“proxy.drift.nhn.no”, 8080))
.proxy(Proxy(“proxy.drift.nhn.no”, 8080))
.noProxyFor(“kubtest.kj.nhn.no”)
.acceptHeader(“application/json, text/javascript, /; q=0.01”)
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“nb-NO,nb;q=0.9,no-NO;q=0.8,no;q=0.6,nn-NO;q=0.5,nn;q=0.4,en-US;q=0.3,en;q=0.1”)
.doNotTrackHeader(“1”)
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0”)
.baseUrl(myProperty)
val httpProtocol = http
.baseUrl(myProperty)
.inferHtmlResources(BlackList("""..js""", “”"..css""", “”"..gif""", “”"..jpeg""", “”"..jpg""", “”"..ico""", “”"..woff""", “”"..woff2""", “”"..(t|o)tf""", “”"..png""", “”".detectportal.firefox.com."""), WhiteList())
.acceptHeader(“application/json, text/javascript, /; q=0.01”)
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“nb-NO,nb;q=0.9,no-NO;q=0.8,no;q=0.6,nn-NO;q=0.5,nn;q=0.4,en-US;q=0.3,en;q=0.1”)
.doNotTrackHeader(“1”)
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0”)
.silentUri(“https://myCDN/.*”)
…
How do I say:
//if ${proxy} true
//setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocolProxy)
//Else
//setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)