From 41bdd2b429da828ead79d142f5b9a37af49838a5 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Mon, 23 Oct 2023 20:23:17 +0100 Subject: [PATCH] Experimental k6 smoketest --- .gitea/workflows/flyctl-deploy.yml | 14 ++++++++++++++ Cargo.toml | 3 +++ k6/smoketest.js | 12 ++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 k6/smoketest.js diff --git a/.gitea/workflows/flyctl-deploy.yml b/.gitea/workflows/flyctl-deploy.yml index 346a94c..0cd9a6a 100644 --- a/.gitea/workflows/flyctl-deploy.yml +++ b/.gitea/workflows/flyctl-deploy.yml @@ -15,3 +15,17 @@ jobs: - run: flyctl deploy --remote-only env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + smoketest: + name: Smoketest + needs: deploy + runs-on: debian-latest-arm + steps: + - name: Checkout + uses: actions/checkout@v3.6.0 + - name: Run k6 local test + uses: https://github.com/grafana/k6-action@v0.3.0 + with: + filename: k6/smoketest.js + flags: -o experimental-prometheus-rw --tag testid=smoketest-${GITHUB_SHA} + env: + K6_PROMETHEUS_RW_SERVER_URL: ${{ secrets.PROMETHEUS_URL }} diff --git a/Cargo.toml b/Cargo.toml index 547b9b0..2a068da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,9 @@ name = "gabrielsimmerdotcom" version = "0.1.0" edition = "2021" +[profile.release] +strip = true # Automatically strip symbols from the binary. + [dependencies] axum = { version = "0.6.18", features = ["json"] } sqlx = { version = "0.7", features = [ "runtime-tokio", "tls-rustls", "sqlite" ] } diff --git a/k6/smoketest.js b/k6/smoketest.js new file mode 100644 index 0000000..1175998 --- /dev/null +++ b/k6/smoketest.js @@ -0,0 +1,12 @@ +import http from 'k6/http'; +import { check, sleep} from 'k6'; + +export const options = { + vus: 3, // Key for Smoke test. Keep it at 2, 3, max 5 VUs + duration: '1m', // This can be shorter or just a few iterations +}; + +export default () => { + const urlRes = http.get('https://gabrielsimmer.com'); + sleep(1); +};