1
1
package api .http .benchmark
2
2
3
3
import com .typesafe .config .ConfigFactory
4
+ import hmda .api .protocol .admin .WriteInstitutionProtocol
5
+ import hmda .model .institution .Institution
4
6
import io .gatling .core .Predef ._
5
7
import io .gatling .http .Predef ._
6
8
7
9
import scala .concurrent .duration ._
8
10
import scala .language .postfixOps
11
+ import spray .json ._
12
+ import hmda .model .institution .InstitutionGenerators ._
9
13
10
- class FilingSimulation extends Simulation {
14
+ class FilingSimulation extends Simulation with WriteInstitutionProtocol {
11
15
12
16
val config = ConfigFactory .load()
13
17
val host = config.getString(" hmda.benchmark.host" )
14
18
val port = config.getInt(" hmda.benchmark.port" )
15
19
val nrOfUsers = config.getInt(" hmda.benchmark.nrOfUsers" )
20
+ val rampUpTime = config.getInt(" hmda.benchmark.rampUpTime" )
16
21
17
22
val institutionIds = (1 to nrOfUsers).toList
18
23
@@ -25,15 +30,21 @@ class FilingSimulation extends Simulation {
25
30
.userAgentHeader(" Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0" )
26
31
.header(" cfpb-hmda-username" , " user" )
27
32
.header(" cfpb-hmda-institutions" , institutionIds.mkString(" ," ))
33
+ .disableCaching
28
34
29
35
val filingScenario = scenario(" HMDA Filing" )
30
36
.exec(http(" GET Institutions" )
31
37
.get(" /institutions" )
32
38
.check(
33
39
status is 200
34
40
))
41
+ // .pause(1)
42
+ // .exec(http("POST Institutions")
43
+ // .post("/institutions")
44
+ // //.post(Institution.empty.toJson.toString()).asJSON
45
+ // .check(status is 201))
35
46
36
47
setUp(filingScenario.inject(
37
- constantUsersPerSec( 2 ) during ( 10 seconds)
48
+ rampUsers(nrOfUsers) over (rampUpTime seconds)
38
49
).protocols(httpProtocol))
39
50
}
0 commit comments