summaryrefslogtreecommitdiff
path: root/test.sh
diff options
context:
space:
mode:
authorMateus Cruz <mateuscolvr@gmail.com>2024-02-05 21:55:58 -0300
committerMateus Cruz <mateuscolvr@gmail.com>2024-02-05 21:55:58 -0300
commitbd700d5098c6b51db63cdabda81d676f5c354eda (patch)
treeaad4c459f89f602f2ebdc5aeb350893cba0d15b1 /test.sh
parent00ade6066e9dd88c65b176bf4788eea4c3e1a15d (diff)
test: add gatling test
Diffstat (limited to 'test.sh')
-rwxr-xr-xtest.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..0bf0b33
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+# Use este script para executar testes locais
+
+RESULTS_WORKSPACE="$(pwd)/load-test/user-files/results"
+GATLING_BIN_DIR="$(pwd)/gatling/bin"
+GATLING_WORKSPACE="$(pwd)/load-test/user-files"
+
+runGatling() {
+ sh $GATLING_BIN_DIR/gatling.sh -rm local -s RinhaBackendCrebitosSimulation \
+ -rd "Rinha de Backend - 2024/Q1: Crébito" \
+ -rf $RESULTS_WORKSPACE \
+ -sf "$GATLING_WORKSPACE/simulations"
+}
+
+startTest() {
+ for i in {1..20}; do
+ # 2 requests to wake the 2 api instances up :)
+ curl --fail http://localhost:9999/clientes/1/extrato && \
+ echo "" && \
+ curl --fail http://localhost:9999/clientes/1/extrato && \
+ echo "" && \
+ runGatling && \
+ break || sleep 2;
+ done
+}
+
+startTest