-
-
Save nremond/4345254 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package other | |
import com.excilys.ebi.gatling.core.Predef._ | |
import com.excilys.ebi.gatling.http.Predef._ | |
import com.excilys.ebi.gatling.jdbc.Predef._ | |
import com.excilys.ebi.gatling.http.Headers.Names._ | |
import akka.util.duration._ | |
import bootstrap._ | |
class ByteArrayBodySimulation extends Simulation { | |
val urlBase = "http://localhost:8080" | |
val httpConf = httpConfig.baseURL(urlBase) | |
val header = Map( | |
"Content-Type" -> "application/octet-stream") | |
val scn = scenario("Scenario name") | |
.repeat(10) { | |
exec(http("Protocol Buffer - hola").post("/hola") | |
.headers(header) | |
.byteArrayBody(session => getByteArrayBody(session))) | |
.pause(7, 8) | |
} | |
setUp(scn.configure.users(10).ramp(1).protocolConfig(httpConf)) | |
val getByteArrayBody = (session: Session) => { | |
import Parse.Implicits.parseByteArray | |
redisPool.withClient(client => | |
client.lpop("TEST")).getOrElse { | |
redisPool.close | |
val errMsg = "There are not enough records in the redis list" | |
throw new RuntimeException(errMsg) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment