Skip to content

Commit 45d027d

Browse files
committed
Setup basic load test
1 parent 3bba496 commit 45d027d

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

build.sbt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import Dependencies._
33
import sbtassembly.AssemblyPlugin.autoImport._
44
import spray.revolver.RevolverPlugin.autoImport.Revolver
55
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
6+
import io.gatling.sbt.GatlingPlugin
67

7-
val commonDeps = Seq(logback, scalaTest, scalaCheck)
8+
val commonDeps = Seq(logback, scalaTest, scalaCheck, gatling, gatlingHighcharts)
89

910
val akkaDeps = commonDeps ++ Seq(akka, akkaCluster, akkaClusterTools, akkaSlf4J, akkaStream, akkaTestkit, constructr, constructrZookeeper, akkaClusterManagement)
1011

@@ -58,6 +59,7 @@ lazy val hmda = (project in file("."))
5859

5960

6061
lazy val cluster = (project in file("cluster"))
62+
.enablePlugins(GatlingPlugin)
6163
.settings(hmdaBuildSettings: _*)
6264
.settings(
6365
Seq(
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package api.http.load
2+
3+
import io.gatling.core.Predef._
4+
import io.gatling.http.Predef._
5+
import scala.concurrent.duration._
6+
import scala.language.postfixOps
7+
8+
class FilingSimulation extends Simulation {
9+
10+
val httpProtocol = http
11+
.baseURL("http://localhost:8080")
12+
.acceptHeader("text/html,application/xhtml+xml,application/json;q=0.9,*/*;q=0.8")
13+
.acceptEncodingHeader("gzip, deflate")
14+
.acceptLanguageHeader("en-US,en;q=0.5")
15+
.acceptLanguageHeader("en-US,en;q=0.5")
16+
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
17+
.header("cfpb-hmda-username", "user")
18+
.header("cfpb-hmda-institutions", "0,1,2,3,4,5,243179,35057,6999998,6999999,4277")
19+
20+
val filingScenario = scenario("HMDA Filing")
21+
.exec(http("GET Institutions")
22+
.get("/institutions")
23+
.check(
24+
status is 200
25+
))
26+
27+
setUp(filingScenario.inject(
28+
constantUsersPerSec(2) during (10 seconds)
29+
).protocols(httpProtocol))
30+
}

project/Dependencies.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,7 @@ object Dependencies {
4141
val alpakkaCassandra = "com.lightbend.akka" %% "akka-stream-alpakka-cassandra" % Version.alpakka
4242
val cassandraDriver = "com.datastax.cassandra" % "cassandra-driver-core" % Version.cassandraDriver
4343
val javaMail = "javax.mail" % "mail" % Version.javaMail
44+
val gatlingHighcharts = "io.gatling.highcharts" % "gatling-charts-highcharts" % Version.gatling % "test"
45+
val gatling = "io.gatling" % "gatling-test-framework" % Version.gatling % "test"
46+
4447
}

project/Version.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ object Version {
2323
val alpakka = "0.13"
2424
val cassandraDriver = "3.2.0"
2525
val javaMail = "1.4.7"
26+
val gatling = "2.3.0"
2627
}

project/gatling.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("io.gatling" % "gatling-sbt" % "2.2.2")

0 commit comments

Comments
 (0)