diff --git a/dev-resources/gatling/LoadSimulation.scala b/dev-resources/gatling/LoadSimulation.scala deleted file mode 100644 index 4d4522b..0000000 --- a/dev-resources/gatling/LoadSimulation.scala +++ /dev/null @@ -1,38 +0,0 @@ - -import io.gatling.core.Predef._ -import io.gatling.http.Predef._ -import io.gatling.jdbc.Predef._ -import scala.concurrent.duration._ -import scala.util.Random - -class LoadSimulation extends Simulation { - - val httpProtocol: Any = http.baseUrl("http://localhost:8080").userAgentHeader("Load Tester") - - def randomUsername(): String = Random.alphanumeric.take(10).mkString - - def randomPassword(): String = Random.alphanumeric.take(10).mkString - - val customers: Any = scenario("Customers") - .exec { s => - val username = randomUsername() - val password = randomPassword() - val payload = s"""{"customer":{"username":"$username","password":"$password"}}""" - val session = s.setAll(Map("payload" -> payload)) - session - } - .exec( - http("customers") - .post("/api/customers") - .header("Content-Type", "application/json") - .body(StringBody(s => s("payload").as[String])) - .check(status.in(201)) - ) - - setUp( - customers.inject( - constantUsersPerSec(10).during(10.seconds), - rampUsersPerSec(10).to(100).during(3.minutes), - ) - ).protocols(httpProtocol) -} diff --git a/resources/migrations/20241124201323-create-customers-table.up.sql b/resources/migrations/20241124201323-create-customers-table.up.sql index b31fbdb..b84b1a3 100644 --- a/resources/migrations/20241124201323-create-customers-table.up.sql +++ b/resources/migrations/20241124201323-create-customers-table.up.sql @@ -1,6 +1 @@ -CREATE TABLE customers ( - id UUID PRIMARY KEY, - username VARCHAR(255) NOT NULL, - name VARCHAR(255), - hashed_password VARCHAR(255) NOT NULL -); +CREATE TABLE customers (id UUID PRIMARY KEY, username VARCHAR(255) NOT NULL, name VARCHAR(255), roles TEXT[], hashed_password VARCHAR(255) NOT NULL);