NCS-59 Create Load tests (#2)

Added a load test and and slight change in structure. To execute type:

Run the load test:
  ./gradlew.bat gatlingRun --simulation simulations.LoadTestSimulation -PbaseUrl=https://st.nowchess.janis-eccarius.de
  -PauthToken=<token> -PmaxUsers=20 -PrampDuration=60

  Run smoke test:
  ./gradlew.bat gatlingRun --simulation simulations.SmokeTestSimulation -PbaseUrl=https://st.nowchess.janis-eccarius.de
  -PauthToken=<token>

---------

Co-authored-by: LQ63 <lkhermann@web.de>
Reviewed-on: #2
Reviewed-by: Janis <janis-e@gmx.de>
This commit was merged in pull request #2.
This commit is contained in:
2026-05-03 22:26:46 +02:00
parent 3fa39bb4f4
commit 0db2bb777f
6 changed files with 70 additions and 33 deletions
@@ -1,35 +1,13 @@
package simulations
import base.BaseSimulation
import endpoints.BoardEndpoints
import io.gatling.core.Predef._
import io.gatling.http.Predef._
/**
* Smoke test: verifies the cluster is reachable and the bearer token is accepted.
*
* Runs a single virtual user that hits GET /healthz and asserts:
* - HTTP 200
* - Response time under 2 000 ms
*
* Use this as a reference when writing new simulations.
*
* Run:
* ./gradlew gatlingRun -PbaseUrl=http://<cluster-service> -PauthToken=<token>
*/
class SmokeTestSimulation extends BaseSimulation {
private val healthzPath: String =
sys.props.getOrElse("healthz.path", "/healthz")
private val scn = scenario("Smoke Test")
.exec(
http(s"GET $healthzPath")
.get(healthzPath)
.check(status.is(200))
.check(responseTimeInMillis.lte(2000))
)
setUp(
scn.inject(atOnceUsers(1))
scenarioFromEndpoint(BoardEndpoints.createGame)
.inject(atOnceUsers(1))
).protocols(httpProtocol)
}