Skip to content

Instantly share code, notes, and snippets.

@infomaven
Created March 6, 2015 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infomaven/96adc6d066b7fa8b36b9 to your computer and use it in GitHub Desktop.
Save infomaven/96adc6d066b7fa8b36b9 to your computer and use it in GitHub Desktop.
package sensorData
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._ // maybe not needed?
import scala.concurrent.duration._
import com.redis._
import io.gatling.redis.feeder._
object MyProtocol {
val httpProtocol = http
.baseURL("http://localhost")
// .extraInfoExtractor((requestStatus, session, request, response) => List.empty)
// .dumpSessionOnFailure
.disableFollowRedirect
.warmUp("http://localhost")
// .disableWarmUp
}
object RedisTestScenario {
val redisPool = new RedisClientPool("localhost", 6379)
val scn = scenario("RedisTest")
.repeat(2) {
feed(RedisFeeder(redisPool, "wordList", RedisFeeder.LPOP))
.exec(
http("redis_test_request")
.post("/")
.body(StringBody("${wordList}"))
.check(status.is(200))
)
.pause(0 milliseconds, 100 milliseconds)
}
}
class RedisDataTest extends Simulation {
setUp(RedisTestScenario.scn.inject
(nothingFor(4 seconds), rampUsers(2) over (10 seconds), nothingFor(1 second))
)
.protocols(MyProtocol.httpProtocol)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment