feat(Gatlin): Setup
Added Gatlin Setup and a test "test".
This commit is contained in:
@@ -1,2 +1,76 @@
|
||||
# Gatlin
|
||||
|
||||
Load and integration tests for the Kubernetes cluster, built with [Gatling](https://gatling.io/) (Scala DSL).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- A JVM (21+) — required to run the Gradle wrapper
|
||||
- No local Gradle or Scala installation required — the wrapper downloads both automatically
|
||||
|
||||
## Running simulations
|
||||
|
||||
```bash
|
||||
./gradlew gatlingRun \
|
||||
-PbaseUrl=http://<cluster-service> \
|
||||
-PauthToken=<bearer-token>
|
||||
```
|
||||
|
||||
On Windows:
|
||||
```bat
|
||||
gradlew.bat gatlingRun -PbaseUrl=http://<cluster-service> -PauthToken=<bearer-token>
|
||||
```
|
||||
|
||||
The bearer token can also be supplied via the environment variable `GATLING_AUTH_TOKEN` instead of `-PauthToken`.
|
||||
|
||||
## Running a specific simulation
|
||||
|
||||
```bash
|
||||
./gradlew gatlingRun --simulation simulations.SmokeTestSimulation \
|
||||
-PbaseUrl=http://<cluster-service> \
|
||||
-PauthToken=<bearer-token>
|
||||
```
|
||||
|
||||
## Reports
|
||||
|
||||
HTML reports are generated under `build/reports/gatling/` after each run.
|
||||
|
||||
## Adding a new simulation
|
||||
|
||||
1. Create a class in `src/gatling/scala/simulations/` that extends `BaseSimulation`.
|
||||
2. Define your scenario and call `setUp(...).protocols(httpProtocol)` — the bearer token and base URL are inherited automatically.
|
||||
|
||||
```scala
|
||||
package simulations
|
||||
|
||||
import base.BaseSimulation
|
||||
import io.gatling.core.Predef._
|
||||
import io.gatling.http.Predef._
|
||||
|
||||
class MyServiceSimulation extends BaseSimulation {
|
||||
|
||||
private val scn = scenario("My Service")
|
||||
.exec(
|
||||
http("GET /api/resource")
|
||||
.get("/api/resource")
|
||||
.check(status.is(200))
|
||||
)
|
||||
|
||||
setUp(
|
||||
scn.inject(rampUsers(10).during(30))
|
||||
).protocols(httpProtocol)
|
||||
}
|
||||
```
|
||||
|
||||
## Project structure
|
||||
|
||||
```
|
||||
src/
|
||||
gatling/
|
||||
scala/
|
||||
base/ - BaseSimulation (shared protocol, auth)
|
||||
simulations/ - one class per scenario group
|
||||
resources/
|
||||
gatling.conf - Gatling configuration overrides
|
||||
data/ - CSV feeders
|
||||
bodies/ - request body templates
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user