- loadtests: centraliser scripts (backend, stream, chat) - backend: health, auth, tracks, uploads, playlists, marketplace - stream: http health, healthz, readyz - chat: WebSocket load (register -> login -> chat token -> WS) - ci: workflow nightly load-test-nightly.yml - docs: README loadtests - make: load-test-smoke, load-test-backend, load-test-all - fix: veza-backend-api Makefile load-test (scripts/load_test_uploads.js -> loadtests)
81 lines
2.4 KiB
YAML
81 lines
2.4 KiB
YAML
name: Load Tests (Nightly)
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 2 * * *'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
load-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install k6
|
|
run: |
|
|
sudo gpg -k
|
|
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
|
|
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
|
|
sudo apt-get update && sudo apt-get install -y k6
|
|
|
|
- name: Start infrastructure
|
|
run: |
|
|
docker-compose -f docker-compose.yml up -d postgres redis rabbitmq
|
|
sleep 15
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.23"
|
|
cache: true
|
|
|
|
- name: Run migrations
|
|
working-directory: veza-backend-api
|
|
env:
|
|
DATABASE_URL: postgresql://veza:devpassword@localhost:15432/veza?sslmode=disable
|
|
REDIS_URL: redis://localhost:16379
|
|
JWT_SECRET: test-jwt-secret-for-load-test
|
|
APP_ENV: test
|
|
run: |
|
|
go mod download
|
|
go run cmd/migrate_tool/main.go || true
|
|
|
|
- name: Start backend API
|
|
working-directory: veza-backend-api
|
|
env:
|
|
DATABASE_URL: postgresql://veza:devpassword@localhost:15432/veza?sslmode=disable
|
|
REDIS_URL: redis://localhost:16379
|
|
RABBITMQ_URL: amqp://veza:devpassword@localhost:15672/
|
|
JWT_SECRET: test-jwt-secret-for-load-test
|
|
APP_ENV: test
|
|
PORT: 8080
|
|
run: |
|
|
go run cmd/api/main.go &
|
|
sleep 15
|
|
|
|
- name: Wait for backend
|
|
run: |
|
|
for i in 1 2 3 4 5 6 7 8 9 10; do
|
|
if curl -sf http://localhost:8080/health; then
|
|
echo "Backend ready"
|
|
exit 0
|
|
fi
|
|
sleep 3
|
|
done
|
|
echo "Backend not ready"
|
|
exit 1
|
|
|
|
- name: Run smoke load test
|
|
run: k6 run loadtests/smoke.js
|
|
|
|
- name: Run backend load test
|
|
run: |
|
|
k6 run --out json=load-results.json loadtests/backend/full.js || true
|
|
continue-on-error: true
|
|
|
|
- name: Upload results
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: load-test-results
|
|
path: load-results.json
|
|
if: always()
|