Skip to content

Commit

Permalink
Add Gatling stress test :wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jaguililla committed Sep 23, 2024
1 parent 392f928 commit 254ddd7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
15 changes: 14 additions & 1 deletion .mvn/parent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<client.package>${openapi.package}.client</client.package>
<image.name>${project.groupId}/${project.artifactId}</image.name>
<image.registry>docker.io</image.registry>
<release.goal>verify</release.goal> <!-- verify | deploy -->
<spring.server>undertow</spring.server> <!-- undertow | jetty -->
<openapi.integration>ui</openapi.integration> <!-- ui | api -->

Expand All @@ -44,6 +43,8 @@

<jacoco.version>0.8.12</jacoco.version>
<archunit.version>1.3.0</archunit.version>
<gatling.version>3.12.0</gatling.version>
<gatling.maven.version>4.9.6</gatling.maven.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -103,6 +104,12 @@
<artifactId>kafka</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>${gatling.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -237,6 +244,12 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling.maven.version}</version>
</plugin>
</plugins>
</build>

Expand Down
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
<client.package>${openapi.package}.client</client.package>
<spring.server>undertow</spring.server>
<openapi.integration>ui</openapi.integration>
<release.goal>deploy</release.goal>
<gatling.simulationClass>
com.github.jaguililla.appointments.GatlingSimulation
</gatling.simulationClass>
</properties>

<distributionManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.github.jaguililla.appointments;

import static io.gatling.javaapi.core.CoreDsl.*;
import static io.gatling.javaapi.http.HttpDsl.*;

import io.gatling.javaapi.core.*;
import io.gatling.javaapi.http.*;

public class GatlingSimulation extends Simulation {

String baseUrl = "http://localhost:18080";

ChainBuilder appointmentsCrud = exec(
http("Create").post("/appointments").check(status().is(201)),
pause(1),
http("Read").get("/appointments").check(status().is(200)),
pause(1),
http("Delete").delete("/appointments").check(status().is(200)),
pause(1)
);

HttpProtocolBuilder httpProtocol = http.baseUrl(baseUrl);
ScenarioBuilder users = scenario("Appointments").exec(appointmentsCrud);

{
setUp(users.injectOpen(rampUsers(10).during(10))).protocols(httpProtocol);
}
}

0 comments on commit 254ddd7

Please sign in to comment.